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

@Entity('result_archives')
export class ResultArchive {
  @PrimaryGeneratedColumn()
  id: number;

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

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

  @Column({ name: 'culture_final_score', type: 'decimal', precision: 5, scale: 2, nullable: true })
  cultureFinalScore: number;

  @Column({ name: 'professional_final_score', type: 'decimal', precision: 5, scale: 2, nullable: true })
  professionalFinalScore: number;

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

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

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


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

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