import type { MarketingCalendarOverviewViewModel } from '#/views/marketing/calendar/types';

/**
 * 文件职责：营销日历页面常量。
 */

/** 查看权限码。 */
export const CALENDAR_VIEW_PERMISSION = 'tenant:marketing:calendar:view';

/** 管理权限码。 */
export const CALENDAR_MANAGE_PERMISSION = 'tenant:marketing:calendar:manage';

/** 日历类型文案映射。 */
export const CALENDAR_TYPE_TEXT_MAP: Record<string, string> = {
  reduce: '满减',
  gift: '满赠',
  second_half: '第二份半价',
  flash_sale: '限时折扣',
  seckill: '秒杀',
  coupon: '优惠券',
  punch_card: '次卡',
};

/** 状态文案映射。 */
export const CALENDAR_STATUS_TEXT_MAP: Record<string, string> = {
  ongoing: '进行中',
  upcoming: '未开始',
  ended: '已结束',
  disabled: '已停用',
};

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