import type { Dayjs } from 'dayjs';

import type {
  MarketingSeckillActivityType,
  MarketingSeckillChannel,
  MarketingSeckillDisplayStatus,
  MarketingSeckillEditorStatus,
  MarketingSeckillListItemDto,
  MarketingSeckillMetricsDto,
  MarketingSeckillPickerCategoryItemDto,
  MarketingSeckillPickerProductItemDto,
  MarketingSeckillProductStatus,
  MarketingSeckillSessionDto,
  MarketingSeckillStatsDto,
} from '#/api/marketing';

/**
 * 文件职责：秒杀活动页面类型定义。
 */

/** 列表筛选表单。 */
export interface SeckillFilterForm {
  status: '' | MarketingSeckillDisplayStatus;
}

/** 抽屉场次表单项。 */
export interface SeckillEditorSessionForm {
  durationMinutes: null | number;
  key: string;
  startTime: string;
}

/** 抽屉商品表单项。 */
export interface SeckillEditorProductForm {
  categoryId: string;
  categoryName: string;
  name: string;
  originalPrice: number;
  perUserLimit: null | number;
  productId: string;
  seckillPrice: null | number;
  soldCount: number;
  spuCode: string;
  status: MarketingSeckillProductStatus;
  stockLimit: null | number;
}

/** 主编辑抽屉表单。 */
export interface SeckillEditorForm {
  activityType: MarketingSeckillActivityType;
  channels: MarketingSeckillChannel[];
  id: string;
  metrics: MarketingSeckillMetricsDto;
  name: string;
  perUserLimit: null | number;
  preheatEnabled: boolean;
  preheatHours: null | number;
  products: SeckillEditorProductForm[];
  sessions: SeckillEditorSessionForm[];
  status: MarketingSeckillEditorStatus;
  storeIds: string[];
  timeRange: [Dayjs, Dayjs] | null;
  validDateRange: [Dayjs, Dayjs] | null;
}

/** 列表卡片视图模型。 */
export type SeckillCardViewModel = MarketingSeckillListItemDto;

/** 统计视图模型。 */
export type SeckillStatsViewModel = MarketingSeckillStatsDto;

/** 选品分类项。 */
export type SeckillPickerCategoryItem = MarketingSeckillPickerCategoryItemDto;

/** 选品商品项。 */
export type SeckillPickerProductItem = MarketingSeckillPickerProductItemDto;

/** 场次规则项。 */
export type SeckillSessionItem = MarketingSeckillSessionDto;
