export const SCENE = {
    NEWUSER: 1,
    REUNION: 2
}

// 对应服务端 activityScene ，7货运 9快送 10全品类
export const CATEGORY = {
  PLATFORM: 10,
  FREIGHT: 7,
  EXPRESS: 9
}

// 任务状态 0-起点；1-未开始；2-待完成；3-已完成
export const TASK_STATUS = {
  ORIGIN: 0,
  UNSTART: 1,
  UNCOMPLETE: 2,
  COMPLETED: 3
}

export const CARD_CATEGORY = {
  COUPON: 612307,
  RIGHT: 'right'
}

// 前端用于渲染的 券/权益卡片状态  枚举
export const CARD_STATUS = {
  CANUSE: 'canuse',
  USED: 'used',
  // 未解锁或已失效或过期
  UNAVAILABLE: 'unavailable'
}

// 服务端存储的 券/权益卡片状态 枚举
export const CARD_STATUS_BACKEND = {
  LOCKED: 0,
  VALID: 1,
  USED: 2,
  NOT_VALID: 3,
  EXPIRED: 4
}

export const BANNER_JSON = {
    topBgs: {
      [SCENE.NEWUSER]: 'https://dpubstatic.udache.com/static/dpubimg/0H6iMSXcp4FIoVEMEsZfb.webp',
      [SCENE.REUNION]: 'https://dpubstatic.udache.com/static/dpubimg/0H6iMSXcp4FIoVEMEsZfb.webp'
    },
    topTitle: {
      [SCENE.NEWUSER]: {
        [CATEGORY.PLATFORM]: '新人专享礼',
        [CATEGORY.FREIGHT]: '送货新人专享礼',
        [CATEGORY.EXPRESS]: '快送新人专享礼'
      },
      [SCENE.REUNION]: {
        [CATEGORY.PLATFORM]: '重逢回馈礼',
        [CATEGORY.FREIGHT]: '送货重逢回馈礼',
        [CATEGORY.EXPRESS]: '快送重逢回馈礼'
      }
    },
    flagBgs: {
      [TASK_STATUS.UNSTART]: 'https://dpubstatic.udache.com/static/dpubimg/EuDAy81WZJLFIghJRIkn7.webp',
      [TASK_STATUS.UNCOMPLETE]: 'https://dpubstatic.udache.com/static/dpubimg/EuDAy81WZJLFIghJRIkn7.webp',
      [TASK_STATUS.COMPLETED]: 'https://dpubstatic.udache.com/static/dpubimg/vIq9M3c4GRnHO9VkJDW63.webp'
    },
    card: {
      statusImgs: {
        [CARD_CATEGORY.COUPON]: {
          [CARD_STATUS.CANUSE]: 'https://dpubstatic.udache.com/static/dpubimg/urWtipI5yJBI9T3pizKO1.webp',
          [CARD_STATUS.USED]: 'https://dpubstatic.udache.com/static/dpubimg/urWtipI5yJBI9T3pizKO1.webp',
          [CARD_STATUS.UNAVAILABLE]: 'https://dpubstatic.udache.com/static/dpubimg/CrZMNglK_Upwq4ckzc8Us.webp'
        },
        [CARD_CATEGORY.RIGHT]: {
          [CARD_STATUS.CANUSE]: 'https://dpubstatic.udache.com/static/dpubimg/i3HBM_GeLaSfQLjlIOM2T.webp',
          [CARD_STATUS.USED]: 'https://dpubstatic.udache.com/static/dpubimg/i3HBM_GeLaSfQLjlIOM2T.webp',
          [CARD_STATUS.UNAVAILABLE]: 'https://dpubstatic.udache.com/static/dpubimg/CrZMNglK_Upwq4ckzc8Us.webp'
        }
      },
      statusTexts: {
        [CARD_STATUS_BACKEND.LOCKED]: '待解锁',
        [CARD_STATUS_BACKEND.VALID]: '待使用',
        [CARD_STATUS_BACKEND.USED]: '已使用',
        [CARD_STATUS_BACKEND.NOT_VALID]: '已失效',
        [CARD_STATUS_BACKEND.EXPIRED]: '已过期'
      }
    }
}

export const getStatusFromBackEnd = (statusTag) => {
  switch (statusTag) {
    case CARD_STATUS_BACKEND.VALID:
      return CARD_STATUS.CANUSE
    case CARD_STATUS_BACKEND.USED:
      return CARD_STATUS.USED
    case CARD_STATUS_BACKEND.LOCKED:
    case CARD_STATUS_BACKEND.NOT_VALID:
    case CARD_STATUS_BACKEND.EXPIRED:
      return CARD_STATUS.UNAVAILABLE
    default:
      return CARD_STATUS.CANUSE
  }
}
