import {Entity, PrimaryGeneratedColumn, Column, OneToMany, ManyToMany, ManyToOne, JoinTable, JoinColumn} from "typeorm";
import {  Student } from "./Student";
import { Classes } from "./Classes";
import { Course } from "./Course";
import { TeachingMode } from "./TeachingMode";

@Entity()
export class ClassDetail {

    @PrimaryGeneratedColumn()
    id!: number;

    @Column({ type: 'text', default: null, nullable: true })
    comment!: string;

    @Column({ type: 'timestamp', default: null, nullable: true })
    startDate!: Date;

    @Column({ type: 'timestamp', default: null, nullable: true })
    endDate!: Date;

    @Column({ type: 'decimal', precision: 10, scale: 2 })
    cost!: number;

    @ManyToMany(type => Student, Student => Student.ClassDetails)
    @JoinTable()
    Students!: Student[];

    @ManyToOne(type => Classes, Class => Class.ClassesDetails)
    Class!: Classes;

    @ManyToOne(type => Course, Course => Course.ClassesDetail)
    Course!: Course;

    

}