import { EntitySchema } from 'typeorm'

export type ClassEntity = {
  id: string
  name: string
  type: string
  teacherName: string | null
  teacherNames: string
  familyPhoto: string | null
}

export const ClassEntitySchema = new EntitySchema<ClassEntity>({
  name: 'ClassEntity',
  tableName: 'classes',
  columns: {
    id: {
      type: String,
      primary: true
    },
    name: {
      type: String
    },
    type: {
      type: String,
      default: 'cheap'
    },
    teacherNames: {
      name: 'teacher_names',
      type: String,
      default: ''
    },
    teacherName: {
      name: 'teacher_name',
      type: String,
      nullable: true
    },
    familyPhoto: {
      name: 'family_photo',
      type: String,
      nullable: true
    }
  },
  relations: {}
})
