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

@Entity({ schema: 'freight', name: 'priority_rules' })
@Index(['code'])
@Index(['isActive'])
export class PriorityRule extends BaseEntity {
  @Column({ name: 'code', type: 'varchar', length: 40, unique: true })
  code!: string;

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

  @Column({ name: 'score', type: 'int', default: 0, nullable: true })
  score!: number;

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

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