import { eBannerLocation, eBannerStatus } from '@/types/banner'
import { eUserStatus } from '@/types/user'
import { editableProductStatus,eGuaranteeType,eProductType} from '@/types/loanProduct'
// import { activityStatus } from "@/service/ActivityService/type"
import moment from 'moment'
import { activityStatus } from '@/service/ActivityService/type'
import { eLevel } from '@/types/level'

export default {
  formatDate(timeStamp: number) {
    const commonLen = new Date().getTime().toString().length
    if (timeStamp.toString().length === commonLen) {
      return moment(timeStamp).format('YYYY-MM-DD HH:mm') // September 14th 2021, 3:22:23 pm
    } else {
      return ''
    }
  },
  filterUserStatus(status: eUserStatus) {
    switch (status) {
      case eUserStatus.disable_noPosition:
        return '禁用'
      case eUserStatus.disable_notOnPosition:
        return '禁用'
      case eUserStatus.enable_notOnPosition:
        return '启用/不在岗'
      case eUserStatus.enable_onPosition:
        return '启用/在岗'
    }
  },
  platformfilterUserStatus(status: eUserStatus) {
    switch (status) {
      case eUserStatus.disable_noPosition:
        return '禁用'
      case eUserStatus.disable_notOnPosition:
        return '禁用'
      case eUserStatus.enable_notOnPosition:
        return '启用'
      case eUserStatus.enable_onPosition:
        return '启用'
    }
  },
  filterBannerLocation(status: eBannerLocation) {
    switch (status) {
      case eBannerLocation.home:
        return '首页'
    }
  },
  filtereBannerStatus(status: eBannerStatus) {
    switch (status) {
      case eBannerStatus.editable:
        return '未发布'
      case eBannerStatus.delete:
        return '删除'
      case eBannerStatus.published:
        return '已发布'
    }
  },
  filterLoanType(type:eProductType) {
    switch (type) {
      case eProductType.company:
        return '企业贷款'
      case eProductType.identity:
        return '个人贷款'
    }
  },
  filterGuaranteeType(type:eGuaranteeType) {
    switch (type) {
      case eGuaranteeType.credit:
        return '信用'
      case eGuaranteeType.mortgage:
        return '抵押'
      case eGuaranteeType.guarantee:
        return '保证'
      case eGuaranteeType.discount:
        return '贴现'
      case eGuaranteeType.composite:
        return '综合'
      case eGuaranteeType.pledge:
        return '质押'
    }
  },
  filterProductStatus(status:editableProductStatus) {
    switch (status) {
      case editableProductStatus.unpublished:
        return '未发布'  
      case editableProductStatus.normal:
        return '已发布/普通'
      case editableProductStatus.hot:
        return '已发布/热门'
    }
  },
  filterActivitytatus(status:activityStatus) {
    switch (status) {
      case activityStatus.editable:
        return '待发布'  
      case activityStatus.published:
        return '已发布'
    }
  },
  filterLevel(level: eLevel) {
    switch(level) {
      case eLevel.firstLevel_branch: 
        return '一级分行'
      case eLevel.firstLevel_sub_branch:
        return '一级支行'
      case eLevel.secondary_branch:
        return '二级分行'
      case eLevel.secondary_sub_branch:
        return '二级支行'
      default: 
        return false
    }
  },
  filterWorkDay(weekend_status: number){
    const silly = '周一至周五'
    if(weekend_status === 0){
      return silly;
    }else if(weekend_status === 1){
      return silly + ', 周六'
    } else if(weekend_status === 2){
      return silly + ', 周日'
    } else if(weekend_status === 3){
      return '周一至周日'
    }
  },
  filterLiveTime(weekend_status: number){
    if(weekend_status === 0){
      return '';
    }else if(weekend_status === 1){
      return '周日'
    } else if(weekend_status === 2){
      return '周一'
    } else if(weekend_status === 3){
      return '周二'
    } else if(weekend_status === 4){
      return '周三'
    } else if(weekend_status === 5){
      return '周四'
    } else if(weekend_status === 6){
      return '周五'
    } else if(weekend_status === 7){
      return '周六'
    } else if(weekend_status === 8){
      return '工作日'
    } else if(weekend_status === 9){
      return '周末'
    } else if(weekend_status === 10){
      return '每天'
    }
  },
} as {
  [key: string]: (...args: any) => any
}
