/** 
 * 全局枚举常量定义
 * 从 mock 数据迁移而来，供运行时代码统一引用
 */

// ==================== 订单状态 ====================

export enum OrderStatus {
  PENDING_PAYMENT = 0,// 待支付
  COMPLETED = 1,      // 已完成
  CANCELLED = 2,      // 已取消
  CLOSED = 3          // 已关闭
}

export const OrderStatusText: Record<number, string> = {
  [OrderStatus.PENDING_PAYMENT]: '待支付',
  [OrderStatus.COMPLETED]: '已完成',
  [OrderStatus.CANCELLED]: '已取消',
  [OrderStatus.CLOSED]: '已关闭'
};

export const OrderStatusColor: Record<number, string> = {
  [OrderStatus.PENDING_PAYMENT]: '#f59e0b',
  [OrderStatus.COMPLETED]: '#10b981',
  [OrderStatus.CANCELLED]: '#94a3b8',
  [OrderStatus.CLOSED]: '#64748b'
};

// ==================== 支付状态 ====================

export const PayStatusText: Record<string, string> = {
  UNPAID: '未支付',
  PAID: '已支付',
  REFUND: '已退款',
  PARTIAL_REFUND: '部分退款'
};

// ==================== 活动状态 ====================

export enum ActivityStatus {
  DRAFT = 0,
  PUBLISHED = 1,
  PAUSED = 2,
  ENDED = 3
}

export const ActivityStatusText: Record<number, string> = {
  [ActivityStatus.DRAFT]: '草稿',
  [ActivityStatus.PUBLISHED]: '进行中',
  [ActivityStatus.PAUSED]: '已暂停',
  [ActivityStatus.ENDED]: '已结束'
};

export const ActivityStatusColor: Record<number, string> = {
  [ActivityStatus.DRAFT]: '#94a3b8',
  [ActivityStatus.PUBLISHED]: '#10b981',
  [ActivityStatus.PAUSED]: '#f59e0b',
  [ActivityStatus.ENDED]: '#64748b'
};

export const ActivityTypeText: Record<number, string> = {
  1: '首单立减',
  2: '优惠折扣',
  3: '商品满减',
  4: '邀请有礼'
};

// ==================== 设备状态 ====================

export enum DeviceStatus {
  ONLINE = 1,       // 在线
  OFFLINE = 0,      // 离线
  MAINTENANCE = 2,  // 维护中
  ERROR = 3         // 故障
}

export const DeviceStatusText: Record<number, string> = {
  [DeviceStatus.ONLINE]: '在线',
  [DeviceStatus.OFFLINE]: '离线',
  [DeviceStatus.MAINTENANCE]: '维护中',
  [DeviceStatus.ERROR]: '故障'
};

export const DeviceStatusColor: Record<number, string> = {
  [DeviceStatus.ONLINE]: '#10b981',
  [DeviceStatus.OFFLINE]: '#94a3b8',
  [DeviceStatus.MAINTENANCE]: '#f59e0b',
  [DeviceStatus.ERROR]: '#ef4444'
};

// ==================== 优惠券类型 ====================

export enum CouponType {
  FULL_REDUCTION = 1,
  DISCOUNT = 2
}

export const CouponTypeText: Record<number, string> = {
  [CouponType.FULL_REDUCTION]: '满减券',
  [CouponType.DISCOUNT]: '折扣券'
};

export const CouponStatusText: Record<number, string> = {
  0: '草稿',
  1: '已上架',
  2: '已下架'
};

// ==================== 商品状态 ====================

export enum ProductStatus {
  ACTIVE = 1,      // 在售
  INACTIVE = 0,    // 下架
  OUT_OF_STOCK = 2 // 缺货
}

export const ProductStatusText: Record<number, string> = {
  [ProductStatus.ACTIVE]: '在售',
  [ProductStatus.INACTIVE]: '已下架',
  [ProductStatus.OUT_OF_STOCK]: '缺货'
};

export const ProductStatusColor: Record<number, string> = {
  [ProductStatus.ACTIVE]: '#10b981',
  [ProductStatus.INACTIVE]: '#94a3b8',
  [ProductStatus.OUT_OF_STOCK]: '#ef4444'
};

// ==================== 库存状态 ====================

export enum InventoryStatus {
  NORMAL = 'normal',
  LOW = 'low',
  OUT = 'out'
}

export const InventoryStatusText: Record<string, string> = {
  [InventoryStatus.NORMAL]: '正常',
  [InventoryStatus.LOW]: '低库存',
  [InventoryStatus.OUT]: '缺货'
};

// ==================== 门店状态 ====================

export enum ShopStatus {
  ACTIVE = 1,       // 正常营业
  INACTIVE = 0,     // 停业
  MAINTENANCE = 2   // 维护中
}

export const ShopStatusText: Record<number, string> = {
  [ShopStatus.ACTIVE]: '营业中',
  [ShopStatus.INACTIVE]: '已停业',
  [ShopStatus.MAINTENANCE]: '维护中'
};

export const ShopStatusColor: Record<number, string> = {
  [ShopStatus.ACTIVE]: '#10b981',
  [ShopStatus.INACTIVE]: '#94a3b8',
  [ShopStatus.MAINTENANCE]: '#f59e0b'
};

// ==================== 用户/客户状态 ====================

export enum UserStatus {
  DISABLED = 0,   // 禁用
  ENABLED = 1     // 正常
}

export const UserStatusText: Record<number, string> = {
  [UserStatus.DISABLED]: '禁用',
  [UserStatus.ENABLED]: '正常'
};

// ==================== 退款状态 ====================

export enum RefundStatus {
  PENDING = 0,
  APPROVED = 1,
  REJECTED = 2,
  COMPLETED = 3
}

export const RefundStatusText: Record<number, string> = {
  [RefundStatus.PENDING]: '待审核',
  [RefundStatus.APPROVED]: '已通过',
  [RefundStatus.REJECTED]: '已驳回',
  [RefundStatus.COMPLETED]: '已完成'
};

export const RefundStatusColor: Record<number, string> = {
  [RefundStatus.PENDING]: '#f59e0b',
  [RefundStatus.APPROVED]: '#10b981',
  [RefundStatus.REJECTED]: '#ef4444',
  [RefundStatus.COMPLETED]: '#0ea5e9'
};

// ==================== 补货单状态 ====================

export enum ReplenishmentOrderStatus {
  DRAFT = 0,
  SUBMITTED = 1,
  SYNCED = 2,
  COMPLETED = 3,
  CANCELLED = 4
}

export const ReplenishmentOrderStatusText: Record<number, string> = {
  [ReplenishmentOrderStatus.DRAFT]: '草稿',
  [ReplenishmentOrderStatus.SUBMITTED]: '已提交',
  [ReplenishmentOrderStatus.SYNCED]: '已同步',
  [ReplenishmentOrderStatus.COMPLETED]: '已完成',
  [ReplenishmentOrderStatus.CANCELLED]: '已取消'
};

// ==================== 定时折扣状态 ====================

export enum TimedDiscountStatus {
  DRAFT = 0,
  ACTIVE = 1,
  PAUSED = 2,
  ENDED = 3
}

export const TimedDiscountStatusText: Record<number, string> = {
  [TimedDiscountStatus.DRAFT]: '草稿',
  [TimedDiscountStatus.ACTIVE]: '进行中',
  [TimedDiscountStatus.PAUSED]: '已暂停',
  [TimedDiscountStatus.ENDED]: '已结束'
};

// ==================== 分销提现审核状态 ====================

export enum DistWithdrawalStatus {
  PENDING = 0,
  APPROVED = 1,
  REJECTED = 2,
  PAID = 3
}

export const DistWithdrawalStatusText: Record<number, string> = {
  [DistWithdrawalStatus.PENDING]: '审核中',
  [DistWithdrawalStatus.APPROVED]: '已通过',
  [DistWithdrawalStatus.REJECTED]: '已驳回',
  [DistWithdrawalStatus.PAID]: '已打款'
};

// ==================== 公告类型 ====================

export enum AnnouncementType {
  SYSTEM = 1,
  ACTIVITY = 2,
  MAINTENANCE = 3,
  OTHER = 4
}

export const AnnouncementTypeText: Record<number, string> = {
  [AnnouncementType.SYSTEM]: '系统公告',
  [AnnouncementType.ACTIVITY]: '活动公告',
  [AnnouncementType.MAINTENANCE]: '维护公告',
  [AnnouncementType.OTHER]: '其他'
};

export const AnnouncementStatusText: Record<number, string> = {
  0: '草稿',
  1: '已发布',
  2: '已下线'
};

// ==================== 通用分页参数 ====================

export const DEFAULT_PAGE_SIZE = 10;
export const MAX_PAGE_SIZE = 100;
