import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  UpdateDateColumn,
} from 'typeorm';

export enum ClassType {
  CULTURE = 'culture',
  PROFESSIONAL = 'professional',
  BOOTCAMP = 'bootcamp',
  SPRINT = 'sprint',
}

export enum ClassStatus {
  ENROLLING = 'enrolling',
  ACTIVE = 'active',
  ENDED = 'ended',
  SUSPENDED = 'suspended',
}

@Entity('classes')
export class Class {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ name: 'name', length: 100 })
  name: string;

  @Column({ name: 'code', length: 50, unique: true })
  code: string;



  @Column({ name: 'class_type', length: 20 })
  classType: string;

  @Column({ name: 'start_date', type: 'date', nullable: true })
  startDate: string;

  @Column({ name: 'end_date', type: 'date', nullable: true })
  endDate: string;

  @Column({ name: 'status', length: 20, default: ClassStatus.ENROLLING })
  status: string;

  @Column({ name: 'head_teacher_id', type: 'integer', nullable: true })
  headTeacherId: number;

  @Column({ name: 'life_teacher_id', type: 'integer', nullable: true })
  lifeTeacherId: number;

  @Column({ name: 'academic_teacher_id', type: 'integer', nullable: true })
  academicTeacherId: number;

  @Column({ name: 'max_students', type: 'integer', default: 0 })
  maxStudents: number;

  @Column({ name: 'notes', type: 'text', nullable: true })
  notes: string;


  @Column({ name: 'is_archived', default: false })
  isArchived: boolean;
  @CreateDateColumn({ name: 'created_at' })
  createdAt: Date;

  @UpdateDateColumn({ name: 'updated_at' })
  updatedAt: Date;
}
