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

@Entity('companies')
export class Companies {
  @PrimaryGeneratedColumn()
  id: number;

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

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

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

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

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

  @Column({ type: 'date', nullable: true })
  founded_at: Date;

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

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

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

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

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

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

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

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

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

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

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

  @Column({ type: 'decimal', precision: 10, scale: 8, nullable: true })
  latitude: number;

  @Column({ type: 'decimal', precision: 11, scale: 8, nullable: true })
  longitude: number;

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

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

  @Column({
    type: 'timestamp',
    default: () => 'CURRENT_TIMESTAMP',
  })
  created_at: Date;

  @Column({
    type: 'timestamp',
    default: () => 'CURRENT_TIMESTAMP',
    onUpdate: 'CURRENT_TIMESTAMP',
  })
  updated_at: Date;

  @Column({ type: 'tinyint', nullable: true, default: 0 })
  is_deleted: number;

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

  // GST and CIN fields
  @Column({ type: 'varchar', length: 50, nullable: true })
  gst_number: string;

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

  // Company approval status
  @Column({ type: 'tinyint', width: 1, default: 0 })
  is_approved: number;

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

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

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

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