import type { Dayjs } from 'dayjs';

import type {
  MarketingFlashSaleChannel,
  MarketingFlashSaleCycleType,
  MarketingFlashSaleDisplayStatus,
  MarketingFlashSaleEditorStatus,
  MarketingFlashSaleListItemDto,
  MarketingFlashSaleMetricsDto,
  MarketingFlashSalePickerCategoryItemDto,
  MarketingFlashSalePickerProductItemDto,
  MarketingFlashSaleProductStatus,
  MarketingFlashSaleRecurringDateMode,
  MarketingFlashSaleStatsDto,
} from '#/api/marketing';

/**
 * 文件职责：限时折扣页面类型定义。
 */

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

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

/** 主编辑抽屉表单。 */
export interface FlashSaleEditorForm {
  channels: MarketingFlashSaleChannel[];
  cycleType: MarketingFlashSaleCycleType;
  id: string;
  metrics: MarketingFlashSaleMetricsDto;
  name: string;
  perUserLimit: null | number;
  products: FlashSaleEditorProductForm[];
  recurringDateMode: MarketingFlashSaleRecurringDateMode;
  status: MarketingFlashSaleEditorStatus;
  storeIds: string[];
  timeRange: [Dayjs, Dayjs] | null;
  validDateRange: [Dayjs, Dayjs] | null;
  weekDays: number[];
}

/** 列表卡片视图模型。 */
export type FlashSaleCardViewModel = MarketingFlashSaleListItemDto;

/** 统计视图模型。 */
export type FlashSaleStatsViewModel = MarketingFlashSaleStatsDto;

/** 选品分类项。 */
export type FlashSalePickerCategoryItem =
  MarketingFlashSalePickerCategoryItemDto;

/** 选品商品项。 */
export type FlashSalePickerProductItem = MarketingFlashSalePickerProductItemDto;
