import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
import { ClassroomStatus } from './classroom-data.schema';

@Entity('classroom_data')
export class ClassroomData {
  @PrimaryGeneratedColumn({ unsigned: true })
  id!: number;

  @Column({ name: 'classroom_no', type: 'varchar', length: 255, nullable: true, comment: '教室号' })
  classroomNo!: string | null;

  @Column({ name: 'training_date', type: 'timestamp', nullable: true, comment: '训练日期' })
  trainingDate!: Date | null;

  @Column({ name: 'holding_stock', type: 'varchar', length: 255, nullable: true, comment: '持股' })
  holdingStock!: string | null;

  @Column({ name: 'holding_cash', type: 'varchar', length: 255, nullable: true, comment: '持币' })
  holdingCash!: string | null;

  @Column({ name: 'price', type: 'varchar', length: 255, nullable: true, comment: '价格' })
  price!: string | null;

  @Column({ name: 'code', type: 'varchar', length: 255, nullable: true, comment: '代码' })
  code!: string | null;

  @Column({ name: 'status', type: 'enum', enum:ClassroomStatus, nullable: true, comment: '状态' })
  status!: ClassroomStatus | null;

  @Column({ name: 'spare', type: 'varchar', length: 255, nullable: true, comment: '备用' })
  spare!: string | null;

  @Column({ name: 'created_by', type: 'int', nullable: true, comment: '创建用户ID' })
  createdBy!: number | null;

  @Column({ name: 'updated_by', type: 'int', nullable: true, comment: '更新用户ID' })
  updatedBy!: number | null;

  @Column({ name: 'created_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
  createdAt!: Date;

  @Column({ name: 'updated_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', onUpdate: 'CURRENT_TIMESTAMP' })
  updatedAt!: Date;
}