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

@Entity({ schema: 'freight', name: 'service_types' })
@Index(['isActive'])
@Index(['displayOrder'])
@Index(['code'])
export class ServiceType extends BaseEntity {
  @Column({ name: 'code', type: 'varchar', length: 50, unique: true, default: '' })
  code!: string;

  @Column({ name: 'service_name', type: 'varchar', length: 255 })
  serviceName!: string;

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

  @Column({ name: 'can_be_booked_alone', type: 'boolean', default: true })
  canBeBookedAlone!: boolean;

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

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

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

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

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

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