// 搜索用的下拉数据列表
import { payOrderType, auditType, auditPaymentType, orderServerType, orderAuditType, rewardModeType,classTime } from '../constant'
// 课程类型
export const courseType = [
  { label: "声部课", value: "SINGLE" },
  { label: "合奏课", value: "MIX" },
  { label: "基础技能课", value: "HIGH" },
  { label: "线上基础技能课", value: "HIGH_ONLINE" },
  { label: "vip课", value: "VIP" },
  { label: "试听课", value: "DEMO" },
  { label: "综合课", value: "COMPREHENSIVE" },
  { label: "网管课", value: "PRACTICE" },
  { label: "乐团网管课", value: "MUSIC_NETWORK" },
  { label: "启蒙课", value: "ENLIGHTENMENT" },
  { label: "集训声部课", value: "TRAINING_SINGLE" },
  { label: "集训合奏课", value: "TRAINING_MIX" },
  { label: "课堂课", value: "CLASSROOM" },
  { label: "对外课", value: "COMM" }
]

export const musicCourseType = [
  { label: "声部课", value: "SINGLE" },
  { label: "合奏课", value: "MIX" },
  { label: "基础技能课", value: "HIGH" },
  { label: "线上基础技能课", value: "HIGH_ONLINE" },
  { label: "乐团网管课", value: "MUSIC_NETWORK" },
  { label: "集训声部课", value: "TRAINING_SINGLE" },
  { label: "集训合奏课", value: "TRAINING_MIX" },
  { label: "课堂课", value: "CLASSROOM" },
  { label: "综合课", value: "COMPREHENSIVE" },
]

export const courseListType = [
  { label: "乐团课", value: "MUSIC" },
  { label: "VIP课", value: "VIP" },
  { label: "网管课", value: "PRACTICE" },
]

// 考勤状态
export const attendance = [
  { label: '正常签到', value: 1 },
  { label: '异常签到', value: 0 },
]

// 工作类型
export const jobNature = [
  { label: '兼职', value: 'PART_TIME' },
  { label: '全职', value: 'FULL_TIME' },
  { label: '临时工', value: 'TEMPORARY' }
]

// 老师状态
export const teacherStatus = [
  { label: '正常', value: '0' },
  { label: '冻结', value: '1' },
  { label: '锁定', value: '9' }
]
export const stuAttendance = [
  { value: "NORMAL", label: "正常" },
  { value: "TRUANT", label: "旷课" },
  { value: "LEAVE", label: "请假" },
]

// 考勤状态
export const attendanceStatus = [
  ...stuAttendance,
  { value: "QUIT_SCHOOL", label: "退学" },
  // { value: "DROP_OUT", label: "休学" }
]


// 交易状态
export const orderStatus = [
  { value: "APPLY", label: "报名" },
  { value: "RENEW", label: "续费" },
  { value: "OTHER", label: "其他" },
  { value: "SMALL_CLASS_TO_BUY", label: "VIP购买" },
  { value: "SPORADIC", label: "零星收费" },
  { value: "LUCK", label: "福袋活动" },
  { value: "DEGREE_REGISTRATION", label: "考级报名" },
  { value: "DOUBLE_ELEVEN2020", label: "双十一活动" },
  { value: "PRACTICE_GROUP_BUY", label: "网管课" },
  { value: 'PRACTICE_GROUP_RENEW', label: '网管课续费' },
  { value: 'REPAIR', label: '乐器维修' },
  { value: 'OUTORDER', label: '外部收入' },
  { value: 'GOODS_SELL', label: '商品销售' },
  { value: 'SUBJECT_CHANGE', label: '声部更换' },

]

// 交易状态
export const dealStatus = [
  { value: "ING", label: "交易中" },
  { value: "SUCCESS", label: "成功交易" },
  { value: "FAILED", label: "交易失败" },
  { value: "CLOSE", label: "交易关闭" }
]

export const musicGroupStatus = [
  { value: 'APPLY', text: '报名中' },
  { value: 'PAY', text: '缴费中' },
  { value: 'PREPARE', text: '筹备中' },
  { value: 'PROGRESS', text: '进行中' },
  { value: 'PAUSE', text: '暂停' },
  { value: 'DRAFT', text: '编辑中' },
  { value: 'AUDIT', text: '审核中' },
  { value: 'AUDIT_FAILED', text: '审核失败' },
  { value: 'CANCELED', text: '取消' },
  { value: 'FEE_AUDIT', text: '费用审核中' },
]

export const vipGroupStatus = [
  { value: '0', text: '未开始' },
  { value: '1', text: '报名中' },
  { value: '5', text: '报名结束' },
  { value: '2', text: '进行中' },
  { value: '4', text: '已结束' },
  { value: '3', text: '取消' },
  { value: '6', text: '暂停' },
]

// 课程状态
export const courseStatus = [
  { value: "NOT_START", label: "未开始" },
  { value: "UNDERWAY", label: "进行中" },
  { value: "OVER", label: "已结束" },
]
export const courseGroupStatus = [
  { value: "NORMAL", label: "正常" },
  { value: "LOCK", label: "锁定" },
  { value: "FINISH", label: "结束" },
  { value: "CANCEL", label: "取消" },
]
export const commGroupStatus = [
  { value: "NORMAL", label: "进行中" },
  { value: "FINISH", label: "结束" },
  { value: "CANCEL", label: "关闭" },
  { value: "LOCK", label: "锁定" },
]

// 老师时间充值状态
export const teacherTimeStatus = [
  { value: "RECHARGE", label: "充值" },
  { value: "CONSUME", label: "建课" },
  { value: "RETURN", label: "退课" },
  { value: "MANUAL_ADD", label: "系统充值" },
  { value: "MANUAL_SUB", label: "系统扣除" },
]

export const practiceGroupType = [
  { value: "FREE", label: "免费" },
  { value: "CHARGE", label: "收费" },
  { value: "TRIAL", label: "试听课" },
]
export const visitChiose = [
  { value: '课程推荐', label: '课程推荐', children: [{ value: '新课推荐', label: '新课推荐' }, { value: '续费提醒', label: '续费提醒' }] },
  { value: '常规回访', label: '常规回访', children: [{ value: '课后及作业回访', label: '课后及作业回访' }, { value: '练习及乐团表现', label: '练习及乐团表现' }] },
  { value: '其它', label: '其它', children: [{ value: '其它', label: '其它' }] }
]

// 交易状态
export const paymentChannelStatus = [
  { value: 'YQPAY', label: '双乾' },
  { value: 'BALANCE', label: '余额' },
  { value: 'ADAPAY', label: '汇付' }
]
// 销售类型
export const saleStatus = [
  { value: 'INSTRUMENT', label: '乐器销售' },
  { value: 'ACCESSORIES', label: '配件销售' },
  { value: 'SCHOOL_BUY', label: '学校采购' },
  { value: 'OTHER', label: '其它' }
]
// 商品类型
export const goodsType = [
  { value: 'INSTRUMENT', label: '乐器' },
  { value: 'ACCESSORIES', label: '辅件' },
  { value: 'TEACHING', label: '教材' },
  { value: 'STAFF', label: '教谱' },
]

export const classStatus = [
  { value: '1', label: '一年级' },
  { value: '2', label: '二年级' },
  { value: '3', label: '三年级' },
  { value: '4', label: '四年级' },
  { value: '5', label: '五年级' },
  { value: '6', label: '六年级' },
  { value: '7', label: '初一' },
  { value: '8', label: '初二' },
  { value: '9', label: '初三' },
  { value: '10', label: '高一' },
  { value: '11', label: '高二' },
  { value: '12', label: '高三' },
]
// 库存类型
export const stockType = [
  { value: 'INTERNAL', label: '内部' },
  { value: 'EXTERNAL', label: '外部' },
  { value: 'ALL', label: '全部' }
]
export const classTimeList = getValueForKey(classTime)

export const payOrderTypeList = getValueForKey(payOrderType)
export const auditTypeList = getValueForKey(auditType)
export const auditPaymentTypeList = getValueForKey(auditPaymentType)
export const orderServerList = getValueForKey(orderServerType)
export const orderAuditTypeList = getValueForKey(orderAuditType)
export const rewardModeTypeList = getValueForKey(rewardModeType)
function getValueForKey (obj) {
  let arr = []
  for (let k in obj) {
    arr.push({ label: obj[k], value: k })
  }
  return arr
}

export const array2object = (array, [lk, vk] = ['value', 'label']) => {
  const object = {}
  if (array && array.length) {
    for (const item of array) {
      object[item[lk]] = item[vk]
    }
  }
  return object
}

// export {
//   courseType,
//   attendance,
//   jobNature,
//   teacherStatus,
//   attendanceStatus,
//   orderStatus,
//   dealStatus,
//   musicGroupStatus,
//   vipGroupStatus,
//   courseStatus,
//   teacherTimeStatus,
//   courseGroupStatus,
//   commGroupStatus,
//   courseListType,
//   practiceGroupType,
//   visitChiose,
//   paymentChannelStatus,
//   saleStatus,
//   goodsType,
//   classStatus,
//   stockType,
//   classTimeList
// }
