/** 订单主状态（与后端 OrderConstants 一致） */
export const ORDER_STATUS = {
  PENDING_PAY: '0',
  PENDING_SHIP: '1',
  SHIPPED: '2',
  COMPLETED: '3',
  CLOSED: '4'
}

/**
 * 列表卡片售后态（与后端 OrderAppConstants 一致）
 * MO-L4：有值时卡片状态区优先展示下列文案
 */
export const ORDER_AFTERSALE_CARD_STATUS = {
  IN_PROGRESS: '1',
  FINISHED: '2'
}

export const ORDER_AFTERSALE_CARD_LABEL = {
  [ORDER_AFTERSALE_CARD_STATUS.IN_PROGRESS]: '售后处理中',
  [ORDER_AFTERSALE_CARD_STATUS.FINISHED]: '售后已完成'
}

/** 订单列表 tab（与后端 OrderAppConstants 一致） */
export const ORDER_TAB = {
  ALL: 'ALL',
  PENDING_PAY: 'PENDING_PAY',
  PENDING_SHIP: 'PENDING_SHIP',
  PENDING_RECEIVE: 'PENDING_RECEIVE',
  COMPLETED: 'COMPLETED',
  CLOSED: 'CLOSED',
  REVIEW_PENDING: 'REVIEW_PENDING',
  REVIEW_DONE: 'REVIEW_DONE'
}

/** 列表页顶部 tab 配置 */
export const ORDER_LIST_TABS = [
  { key: ORDER_TAB.ALL, label: '全部' },
  { key: ORDER_TAB.PENDING_PAY, label: '待付款' },
  { key: ORDER_TAB.PENDING_SHIP, label: '待发货' },
  { key: ORDER_TAB.PENDING_RECEIVE, label: '待收货' },
  { key: ORDER_TAB.COMPLETED, label: '已完成' },
  { key: ORDER_TAB.CLOSED, label: '已关闭' }
]

/** 个人中心快捷入口 */
export const ORDER_MINE_SHORTCUTS = [
  { key: ORDER_TAB.PENDING_PAY, label: '待付款', icon: 'rmb-circle' },
  { key: ORDER_TAB.PENDING_SHIP, label: '待发货', icon: 'bag' },
  { key: ORDER_TAB.PENDING_RECEIVE, label: '待收货', icon: 'car' },
  { key: 'AFTERSALE', label: '退款/售后', icon: 'server-man' }
]

/** 列表操作按钮枚举 */
export const ORDER_ACTION = {
  PAY: 'PAY',
  CONFIRM_RECEIVE: 'CONFIRM_RECEIVE',
  REVIEW: 'REVIEW',
  VIEW_REVIEW: 'VIEW_REVIEW',
  AFTERSALE: 'AFTERSALE',
  BUY_AGAIN: 'BUY_AGAIN'
}

export const ORDER_ACTION_LABEL = {
  [ORDER_ACTION.PAY]: '去支付',
  [ORDER_ACTION.CONFIRM_RECEIVE]: '确认收货',
  [ORDER_ACTION.REVIEW]: '评价',
  [ORDER_ACTION.VIEW_REVIEW]: '查看评价',
  [ORDER_ACTION.AFTERSALE]: '申请售后',
  [ORDER_ACTION.BUY_AGAIN]: '再买一单'
}

export const ORDER_PAGE_SIZE = 10

/** 评价列表 tab */
export const REVIEW_TAB = {
  PENDING: 'PENDING',
  DONE: 'DONE'
}

/** 订单商品行评价态（与后端 OrderAppConstants 一致） */
export const REVIEW_ITEM_STATUS = {
  NONE: 'NONE',
  PENDING: 'PENDING',
  DONE: 'DONE'
}

export const REVIEW_TABS = [
  { key: REVIEW_TAB.PENDING, label: '待评价' },
  { key: REVIEW_TAB.DONE, label: '已评价' }
]

export const REVIEW_SCORE_MAX = 5
export const REVIEW_PIC_MAX = 9
export const REVIEW_CONTENT_MAX = 500

/** 售后列表 tab */
export const AFTERSALE_TAB = {
  IN_PROGRESS: 'IN_PROGRESS',
  FINISHED: 'FINISHED'
}

export const AFTERSALE_TABS = [
  { key: AFTERSALE_TAB.IN_PROGRESS, label: '进行中' },
  { key: AFTERSALE_TAB.FINISHED, label: '已完结' }
]

/** 售后申请类型 */
export const AFTERSALE_APPLY_TYPE = {
  REFUND_UNSHIPPED: '1',
  REFUND_SHIPPED: '2',
  RETURN_REFUND: '3'
}

export const AFTERSALE_APPLY_TYPE_OPTIONS = [
  { value: AFTERSALE_APPLY_TYPE.REFUND_UNSHIPPED, label: '仅退款-未发货' },
  { value: AFTERSALE_APPLY_TYPE.REFUND_SHIPPED, label: '仅退款-已发货' },
  { value: AFTERSALE_APPLY_TYPE.RETURN_REFUND, label: '退货退款' }
]

/** 售后原因（按申请类型） */
export const AFTERSALE_REASON_MAP = {
  [AFTERSALE_APPLY_TYPE.REFUND_UNSHIPPED]: ['不想要了', '拍错了', '收货信息填错'],
  [AFTERSALE_APPLY_TYPE.REFUND_SHIPPED]: ['商品质量问题', '协商差价退款'],
  [AFTERSALE_APPLY_TYPE.RETURN_REFUND]: [
    '不想要了',
    '买错了',
    '商品质量问题',
    '发错货',
    '商品描述与实物不符'
  ]
}

export const AFTERSALE_EVIDENCE_MAX = 9
export const AFTERSALE_DESC_MAX = 500
