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

@Entity('learning_records')
export class LearningRecord {
  @PrimaryGeneratedColumn()
  id: number;

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

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

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

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

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

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

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


  @Column({ type: 'varchar', length: 20, default: 'active' })
  status: 'active' | 'archived';

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

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