import { reactive } from 'vue'

export const basePlan = {
  plan: '',
  startTime: '',
  endTime: '',
  classNum: 1
}

const original = () => {
  return {
    subjectList: [], // 声部列表
    active: 0,
    rate: 0,
    minutes: [] as any,
    tabIndex: 1,
    templateList: [
      'https://oss.dayaedu.com/video-course/1657853010619green.png',
      'https://oss.dayaedu.com/video-course/1657853051064gray.png',
      'https://oss.dayaedu.com/video-course/1657853062314yellow.png',
      'https://oss.dayaedu.com/video-course/1657853076136linear.png'
    ], // 模板列表
    selectCourseList: [] as any, // 选择课程列表
    coursePlanStatus: false, // 是否有锁课程
    live: {
      courseGroupId: '',
      teacherId: '',
      name: '',
      subjectId: null as any,
      subjectName: '',
      courseIntroduce: '',
      courseNum: null as any,
      singleCourseMinutes: 0,
      singleMins: null as any,
      freeMinutes: 0,
      coursePrice: null as any,
      salesStartDate: '',
      salesEndDate: '',
      mixStudentNum: null as any,
      backgroundPic: '',
      backgroundPicTemplate: '',
      coursePlanList: [
        {
          ...basePlan
        }
      ]
    }
  }
}

export const createState = reactive(original())

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