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

export enum VendorType {
  DEALER = 'DEALER',
  LEASING = 'LEASING',
  PARTS = 'PARTS',
  SERVICE = 'SERVICE',
  OTHER = 'OTHER',
}

@Entity({ name: 'vendors', schema: 'freight' })
export class Vendor extends BaseEntity {
  @Column({ name: 'name' })
  name!: string;

  @Column({ name: 'type', type: 'varchar', nullable: true })
  type?: VendorType;

  @Column({ name: 'contact_person', nullable: true })
  contactPerson?: string;

  @Column({ name: 'phone', nullable: true })
  phone?: string;

  @Column({ name: 'email', nullable: true })
  email?: string;

  @Column({ name: 'address', nullable: true })
  address?: string;

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