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

@Entity({ schema: 'freight', name: 'priority_configs' })
@Index(['type', 'isActive'])
@Index(['currency', 'type'])
export class PriorityConfig extends BaseEntity {
  @Column({ name: 'type', type: 'varchar', length: 20 })
  type!: 'WAGON' | 'CURRENCY';

  @Column({ name: 'label', type: 'varchar', length: 100 })
  label!: string;

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

  @Column({ name: 'min_wagon_count', type: 'int' })
  minWagonCount!: number;

  @Column({ name: 'max_wagon_count', type: 'int' })
  maxWagonCount!: number;

  @Column({ name: 'score_points', type: 'int', default: 0 })
  scorePoints!: number;

  @Column({ name: 'is_active', type: 'boolean', default: false })
  isActive!: boolean;

  @Column({ name: 'display_order', type: 'int', default: 1 })
  displayOrder!: number;
}
