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

@Entity('attendance_period_configs')
@Index(['periodKey'], { unique: true })
@Index(['sortOrder'])
export class AttendancePeriodConfig {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ name: 'period_key', type: 'varchar', length: 40 })
  periodKey: string;

  @Column({ type: 'varchar', length: 40 })
  label: string;

  @Column({ name: 'start_time', type: 'varchar', length: 5 })
  startTime: string;

  @Column({ name: 'end_time', type: 'varchar', length: 5 })
  endTime: string;

  @Column({ name: 'sort_order', type: 'integer', default: 0 })
  sortOrder: number;

  @Column({ type: 'boolean', default: true })
  enabled: boolean;

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

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