import type { BrandTeam } from './brand-health' export const BUSINESS_TREND_WEEK_LABELS = [ 'W1', 'W2', 'W3', 'W4', 'W5', 'W6', 'W7', 'W8', ] as const export const BUSINESS_TREND_STAGES = [ { key: 'brief', label: 'Brief' }, { key: 'design', label: '设计' }, { key: 'shooting', label: '拍摄' }, { key: 'post', label: '后期' }, { key: 'pending-launch', label: '待上线' }, ] as const export type BusinessTrendStageKey = (typeof BUSINESS_TREND_STAGES)[number]['key'] export type BusinessTrendBrand = { key: string name: string team: BrandTeam planned: number[] actual: number[] stages: Record } export type BusinessTrendSummary = { plannedTotal: number actualTotal: number attainmentRate: number | null } export const BUSINESS_TREND_BRANDS: BusinessTrendBrand[] = [ { key: 'pumei', name: '朴美', team: '创意A', planned: [4, 5, 5, 6, 6, 5, 7, 6], actual: [3, 5, 4, 6, 5, 5, 6, 6], stages: { brief: 6, design: 8, shooting: 5, post: 7, 'pending-launch': 4 }, }, { key: 'sophia', name: '索菲亚', team: '创意A', planned: [5, 5, 6, 6, 7, 6, 7, 7], actual: [5, 4, 6, 5, 6, 6, 7, 6], stages: { brief: 7, design: 9, shooting: 6, post: 8, 'pending-launch': 5 }, }, { key: 'kukahome', name: '顾家', team: '创意A', planned: [3, 4, 4, 5, 5, 5, 6, 6], actual: [3, 3, 4, 4, 5, 4, 6, 5], stages: { brief: 5, design: 7, shooting: 4, post: 6, 'pending-launch': 3 }, }, { key: 'ouyilang', name: '欧意朗', team: '创意B', planned: [4, 4, 5, 5, 5, 6, 6, 6], actual: [4, 4, 5, 5, 4, 6, 5, 6], stages: { brief: 6, design: 7, shooting: 5, post: 7, 'pending-launch': 5 }, }, { key: 'zhuohe', name: '卓禾', team: '创意B', planned: [3, 3, 4, 4, 5, 5, 5, 6], actual: [2, 3, 4, 4, 4, 5, 5, 5], stages: { brief: 4, design: 6, shooting: 4, post: 5, 'pending-launch': 3 }, }, { key: 'yijiada', name: '亿家达', team: '创意B', planned: [4, 5, 4, 5, 6, 6, 7, 7], actual: [4, 5, 4, 5, 5, 6, 7, 6], stages: { brief: 6, design: 8, shooting: 6, post: 8, 'pending-launch': 4 }, }, ] export function summarizeBusinessTrend(brand: BusinessTrendBrand): BusinessTrendSummary { const plannedTotal = brand.planned.reduce((total, value) => total + value, 0) const actualTotal = brand.actual.reduce((total, value) => total + value, 0) const attainmentRate = plannedTotal === 0 ? null : Math.round((actualTotal / plannedTotal) * 1000) / 10 return { plannedTotal, actualTotal, attainmentRate } }