import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity('invoice_issuers')
export class InvoiceIssuer {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ type: 'varchar', length: 255 })
  company_name: string;

  @Column({ type: 'varchar', length: 20 })
  invoice_prefix: string;

  @Column({ type: 'varchar', length: 50 })
  gstin: string;

  @Column({ type: 'text', nullable: true })
  registered_address: string;

  @Column({ type: 'int', nullable: true })
  state_id: number;

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

  @Column({ type: 'varchar', length: 50, nullable: true })
  phone: string;

  @Column({ type: 'varchar', length: 255, nullable: true })
  logo_url: string;

  @Column({
    type: 'varchar',
    length: 20,
    nullable: true,
    comment: 'Company PAN (printed on invoice)',
  })
  pan: string;

  @Column({
    type: 'varchar',
    length: 30,
    nullable: true,
    comment: 'Company CIN (printed on invoice)',
  })
  cin: string;

  @Column({
    type: 'varchar',
    length: 50,
    nullable: true,
    comment: 'MSME / UDYAM registration number',
  })
  msme_no: string;

  @Column({
    type: 'int',
    nullable: true,
    comment: 'City shown on invoice header',
  })
  city_id: number;

  @Column({ type: 'text', nullable: true, comment: 'Invoice declaration text' })
  declaration_text: string;

  @Column({
    type: 'varchar',
    length: 255,
    nullable: true,
    comment: 'Jurisdiction line on invoice',
  })
  jurisdiction_text: string;

  @Column({
    type: 'varchar',
    length: 255,
    nullable: true,
    comment: 'Footer note like computer-generated invoice',
  })
  footer_note: string;

  @Column({ type: 'tinyint', width: 1, default: 0 })
  is_default: number;

  @Column({ type: 'tinyint', width: 1, default: 1 })
  is_active: number;

  @CreateDateColumn()
  created_at: Date;

  @UpdateDateColumn()
  updated_at: Date;
}
