import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  UpdateDateColumn,
  ManyToOne,
  JoinColumn,
} from 'typeorm';
import { Student } from './student.entity';

@Entity('student_enrollments')
export class StudentEnrollment {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ name: 'student_id', type: 'integer' })
  studentId: number;

  @ManyToOne(() => Student, { eager: true })
  @JoinColumn({ name: 'student_id' })
  student: Student;

  @Column({ name: 'course_category', length: 50, nullable: true })
  courseCategory: string;

  @Column({ name: 'class_type', length: 50, nullable: true })
  classType: string;

  @Column({ name: 'class_name', length: 100, nullable: true })
  className: string;

  @Column({ name: 'head_teacher', length: 50, nullable: true })
  headTeacher: string;

  @Column({ name: 'subject_teacher', length: 50, nullable: true })
  subjectTeacher: string;

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

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

  @Column({ length: 20, default: 'active' })
  status: string;


  @CreateDateColumn({ name: 'created_at' })
  createdAt: Date;

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