import type { OptionItem } from '../../types';

import type {
  CustomerAnalysisOverviewDto,
  CustomerAnalysisPeriodFilter,
  CustomerAnalysisSegmentCode,
} from '#/api/customer';

/** 客户分析查看权限。 */
export const CUSTOMER_ANALYSIS_VIEW_PERMISSION =
  'tenant:customer:analysis:view';

/** 统计周期选项。 */
export const ANALYSIS_PERIOD_OPTIONS: OptionItem[] = [
  { label: '近7天', value: '7d' },
  { label: '近30天', value: '30d' },
  { label: '近90天', value: '90d' },
  { label: '近1年', value: '365d' },
];

/** 默认统计周期。 */
export const DEFAULT_PERIOD: CustomerAnalysisPeriodFilter = '30d';

/** 默认分群。 */
export const DEFAULT_SEGMENT_CODE: CustomerAnalysisSegmentCode = 'all';

/** 默认总览数据。 */
export const EMPTY_OVERVIEW: CustomerAnalysisOverviewDto = {
  periodCode: DEFAULT_PERIOD,
  periodDays: 30,
  totalCustomers: 0,
  newCustomers: 0,
  growthRatePercent: 0,
  newCustomersDailyAverage: 0,
  activeCustomers: 0,
  activeRatePercent: 0,
  averageLifetimeValue: 0,
  growthTrend: [],
  composition: [],
  amountDistribution: [],
  rfmRows: [],
  topCustomers: [],
};
