import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn } from 'typeorm';

export enum ClassroomStatus {
  AVAILABLE = 'available',
  MAINTENANCE = 'maintenance',
  ARCHIVED = 'archived',
}

@Entity('classrooms')
export class Classroom {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ length: 50 })
  name: string;

  @Column({ length: 50, nullable: true })
  building: string;

  @Column({ nullable: true })
  floor: number;

  @Column({ default: 30 })
  capacity: number;

  @Column({ name: 'room_type', type: 'varchar', length: 20, default: '大' })
  roomType: string; // 大 / 次大 / 小

  @Column({ type: 'varchar', length: 20, default: ClassroomStatus.AVAILABLE })
  status: ClassroomStatus | 'available' | 'maintenance' | 'archived';

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

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