import { Column, Entity, Index } from 'typeorm';
import { BaseEntity } from '@edr/api-common';

@Entity({ schema: 'freight', name: 'train_composition_removal_logs' })
@Index(['scheduleId'])
export class TrainCompositionRemovalLog extends BaseEntity {
  @Column({ name: 'schedule_id', type: 'uuid' }) scheduleId!: string;

  @Column({ name: 'booking_id', type: 'uuid' }) bookingId!: string;

  @Column({ name: 'booking_reference', type: 'varchar', length: 64, nullable: true })
  bookingReference?: string | null;

  @Column({ name: 'removed_by_user_id', type: 'uuid', nullable: true })
  removedByUserId?: string | null;

  @Column({ name: 'removed_at', type: 'timestamptz', default: () => 'NOW()' })
  removedAt!: Date;

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