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

@Entity({ schema: 'freight', name: 'customers' })
@Index(['email'])
//@Index(['userId'])
@Index(['tinNumber'])
@Index(['fanNumber'])
export class Customer extends BaseEntity {
  //@Column({ name: 'user_id', type: 'uuid' })
  //userId!: string;

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

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

  @Column({ name: 'email', type: 'varchar', length: 150, unique: true })
  email!: string;

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

  @Column({ name: 'company_name', type: 'varchar', length: 200 })
  companyName!: string;

  @Column({ name: 'company_email', type: 'varchar', length: 150 })
  companyEmail!: string;

  @Column({ name: 'company_phone', type: 'varchar', length: 20 })
  companyPhone!: string;

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

  @Column({ name: 'company_address', type: 'text' })
  companyAddress!: string;

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

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

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

  @Column({ name: 'contact_person_phone', type: 'varchar', length: 20 })
  contactPersonPhone!: string;

  @Column({ name: 'tin_number', type: 'varchar', length: 10, unique: true })
  tinNumber!: string;

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

  @Column({ name: 'fan_number', type: 'varchar', length: 16, unique: true })
  fanNumber!: string;

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

  @Column({ name: 'general_manager_email', type: 'varchar', length: 150 })
  generalManagerEmail!: string;

  @Column({ name: 'general_manager_phone', type: 'varchar', length: 20 })
  generalManagerPhone!: string;

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

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

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

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

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

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