import type { TFunction } from '@barev/i18n'; /** Краткое описание параметров заказа: «Генеральная · 2 комнаты · 2 санузла» */ export function paramsSummary(t: TFunction, serviceCode: string, params: Record): string { if (serviceCode !== 'cleaning') return ''; const parts = [t(`params.cleaning.cleaningType.${String(params.cleaningType)}`), t('params.cleaning.rooms.count', { count: Number(params.rooms ?? 1) })]; const baths = Number(params.bathrooms ?? 1); if (baths > 1) parts.push(t('params.cleaning.bathrooms.count', { count: baths })); return parts.join(' · '); } /** Выбранные доп. услуги: [{ code, qty, label: «Мытьё окон × 3» }] */ export function paramsExtras(t: TFunction, params: Record) { const extras = params.extras; if (!extras || typeof extras !== 'object') return []; return Object.entries(extras as Record) .filter(([, qty]) => qty > 0) .map(([code, qty]) => ({ code, qty, label: `${t(`extras.${code}.name`)}${qty > 1 ? ` × ${qty}` : ''}` })); }