import type {
  MarketingCalendarActivityDto,
  MarketingCalendarConflictDto,
  MarketingCalendarOverviewDto,
  MarketingCalendarStatsDto,
} from '#/api/marketing';

/**
 * 文件职责：营销日历页面类型定义。
 */

/** 月份游标。 */
export interface MarketingCalendarMonthCursor {
  month: number;
  year: number;
}

/** 活动视图模型。 */
export type MarketingCalendarActivityViewModel = MarketingCalendarActivityDto;

/** 冲突视图模型。 */
export type MarketingCalendarConflictViewModel = MarketingCalendarConflictDto;

/** 统计视图模型。 */
export type MarketingCalendarStatsViewModel = MarketingCalendarStatsDto;

/** 页面总览视图模型。 */
export type MarketingCalendarOverviewViewModel = MarketingCalendarOverviewDto;

/** 创建默认总览。 */
export function createDefaultMarketingCalendarOverview(
  cursor: MarketingCalendarMonthCursor,
): MarketingCalendarOverviewViewModel {
  return {
    month: `${cursor.year}-${String(cursor.month).padStart(2, '0')}`,
    year: cursor.year,
    monthValue: cursor.month,
    monthStartDate: '',
    monthEndDate: '',
    todayDay: 0,
    days: [],
    legends: [],
    stats: {
      totalActivityCount: 0,
      ongoingCount: 0,
      maxConcurrentCount: 0,
      estimatedDiscountAmount: 0,
    },
    conflictBanner: null,
    conflicts: [],
    activities: [],
  };
}
