import { reactive } from "vue";

// 训练周次
export const weekdays = [{
  text: '周一',
  value: 'MONDAY'
}, {
  text: '周二',
  value: 'TUESDAY'
}, {
  text: '周三',
  value: 'WEDNESDAY'
}, {
  text: '周四',
  value: 'THURSDAY'
}, {
  text: '周五',
  value: 'FRIDAY'
}, {
  text: '周六',
  value: 'SATURDAY'
}, {
  text: '周日',
  value: 'SUNDAY'
}]


// 格式化
export const weekFormat = (val: any) => {
  const template = {
    MONDAY: '周一',
    TUESDAY: '周二',
    WEDNESDAY: '周三',
    THURSDAY: '周四',
    FRIDAY: '周五',
    SATURDAY: '周六',
    SUNDAY: '周日'
  }
  if (val) {
    return template[val]
  }
  return val
}



const original = () => {
  return {
    status: false, // 未设置伴学老师弹窗
    weekStatus: false, // 时间
    calendarStatus: false, // 日期
    classStatus: false, // 班级设置伴学老师
    timerStatus: false, // 时间状态
    skipHoliday: 1, // 是否节假日
    week: null as any, // 周次
    times: 16, // 训练次数
    trainTimer: 120, // 默认120分钟
    classList: [] as any, // 没有设置伴学指导的数据
    calendarList: [] as any,
    calendarDate: null as any,
    trainStartDate: null, // 开始日期
    trainStartTime: null, // 开始时间
    timerList: {} as any, // 可选和不可选时间段
    numberStatus: false,
    numberDialogStatus: false, // 提示暂无训练次数提示
    pickerNum: 16, // 默认16次
    timerPickerList: [] as any, // 可排课次数
    selectOrchestraId: null as any, // 课程预览时选中的乐团编号
    selectClassGroupId: null as any, // 课程预览时选中的课程组编号
    planList: {
      orchestra: [] as any, // 所有的乐团
      classes: {} as any, // 所有的班级
      course: {} as any // 所有的课程
    } as any,

    classDate: [] as any,
    classType: [] as any, // 乐团加课的课程类型
    classPracticeList: [] as any, // 乐团加课课程列表初始化数据
  }
}

export const forms = reactive(original())

// 重置对象
export const resestState = () => {
  Object.assign(forms, original())
}
