import type {
  MemberDaySettingDto,
  MemberDetailDto,
  MemberListItemDto,
  MemberListStatsDto,
  MemberTierBenefitsDto,
  MemberTierRuleDto,
} from '#/api/member';
import type { StoreListItemDto } from '#/api/store';

export type MemberTabKey = 'list' | 'tiers';

export interface MemberFilterState {
  keyword: string;
  tierId: string;
}

export interface MemberPaginationState {
  page: number;
  pageSize: number;
  total: number;
}

export interface MemberTierEditorForm {
  benefits: MemberTierBenefitsDto;
  colorHex: string;
  iconKey: string;
  isDefault: boolean;
  name: string;
  rule: MemberTierRuleDto;
  sortOrder: number;
  tierId?: string;
}

export interface OptionItem {
  label: string;
  value: string;
}

export interface MemberListPageState {
  activeTab: MemberTabKey;
  detail: MemberDetailDto | null;
  detailOpen: boolean;
  detailLoading: boolean;
  filters: MemberFilterState;
  isExporting: boolean;
  isListLoading: boolean;
  pagination: MemberPaginationState;
  rows: MemberListItemDto[];
  selectedStoreId: string;
  stats: MemberListStatsDto;
  stores: StoreListItemDto[];
  tagSaving: boolean;
  tierEditorOpen: boolean;
  tierEditorLoading: boolean;
  tierEditorSubmitting: boolean;
  tierForm: MemberTierEditorForm | null;
  tierLoading: boolean;
  weekdaySaving: boolean;
  daySetting: MemberDaySettingDto | null;
}
