/**
 * 供应商数据模型接口定义
 * 作者: 阿瑞
 * 功能: 定义供应商数据结构
 * 版本: 1.0
 */

/**
 * 供应商信息接口
 */
export interface ISupplier {
  id?: number;
  order?: number;
  name: string;
  contact?: {
    phone?: string;
    contactPerson?: string;
    address?: string;
  };
  status?: number;
  level?: string;
  type?: string;
  remark?: string;
  created_at?: string;
  updated_at?: string;
  categories?: number[];
}

/**
 * 供应商列表项接口
 */
export interface ISupplierListItem {
  id: number;
  order: number;
  name: string;
  status: number;
  contact?: {
    phone?: string;
    contactPerson?: string;
    address?: string;
  };
}

/**
 * 供应商状态枚举
 */
export const SupplierStatus = {
  DISABLED: 0,   // 停用
  ENABLED: 1,    // 启用
  ABNORMAL: 2,   // 异常
  STANDBY: 3,    // 备用
  BACKUP: 4      // 后备
};

/**
 * 供应商状态文本映射
 */
export const SupplierStatusText: Record<number, string> = {
  [SupplierStatus.DISABLED]: '停用',
  [SupplierStatus.ENABLED]: '启用',
  [SupplierStatus.ABNORMAL]: '异常',
  [SupplierStatus.STANDBY]: '备用',
  [SupplierStatus.BACKUP]: '后备'
};

/**
 * 供应商状态颜色映射
 */
export const SupplierStatusColor: Record<number, string> = {
  [SupplierStatus.DISABLED]: 'text-gray-500 bg-gray-100 dark:bg-gray-700 dark:text-gray-400',
  [SupplierStatus.ENABLED]: 'text-green-800 bg-green-100 dark:bg-green-900/30 dark:text-green-400',
  [SupplierStatus.ABNORMAL]: 'text-red-800 bg-red-100 dark:bg-red-900/30 dark:text-red-400',
  [SupplierStatus.STANDBY]: 'text-blue-800 bg-blue-100 dark:bg-blue-900/30 dark:text-blue-400',
  [SupplierStatus.BACKUP]: 'text-purple-800 bg-purple-100 dark:bg-purple-900/30 dark:text-purple-400'
};