/**
 * 文件职责：成本管理页面本地类型定义。
 */
import type {
  FinanceCostAnalysisDto,
  FinanceCostCategoryCode,
  FinanceCostCompositionDto,
  FinanceCostDimension,
  FinanceCostEntryCategoryDto,
  FinanceCostEntryDetailDto,
  FinanceCostTrendPointDto,
} from '#/api/finance/cost';

/** 页面 Tab 键。 */
export type FinanceCostTabKey = 'analysis' | 'entry';

/** 选项项。 */
export interface OptionItem {
  label: string;
  value: string;
}

/** 成本分类视图模型。 */
export interface FinanceCostCategoryViewModel extends FinanceCostEntryCategoryDto {
  expanded: boolean;
}

/** 录入区域状态。 */
export interface FinanceCostEntryState {
  categories: FinanceCostCategoryViewModel[];
  costRate: number;
  monthRevenue: number;
  totalCost: number;
}

/** 分析区域状态。 */
export interface FinanceCostAnalysisState {
  composition: FinanceCostCompositionDto[];
  detailRows: FinanceCostAnalysisDto['detailRows'];
  stats: FinanceCostAnalysisDto['stats'];
  trend: FinanceCostTrendPointDto[];
}

/** 明细抽屉模式。 */
export type CostDetailDrawerMode = 'create' | 'edit';

/** 明细抽屉状态。 */
export interface CostDetailDrawerState {
  category: FinanceCostCategoryCode;
  mode: CostDetailDrawerMode;
  open: boolean;
  sourceItem?: FinanceCostEntryDetailDto;
}

/** 删除弹窗状态。 */
export interface CostDeleteModalState {
  category: FinanceCostCategoryCode;
  item?: FinanceCostEntryDetailDto;
  open: boolean;
}

/** 页面筛选状态。 */
export interface FinanceCostFilterState {
  dimension: FinanceCostDimension;
  month: string;
  storeId: string;
}
