import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  ManyToOne,
  JoinColumn,
} from "typeorm"
import { BaseEntity } from "../../common/entities/base.entity"
import { Company } from "../../company/entities/company.entity"

@Entity("clients")
export class Client extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number

  @Column({ type: "int", nullable: false })
  company_id: number

  @Column({ type: "varchar", length: 255, nullable: false })
  name: string

  @Column({ type: "varchar", length: 255, nullable: true })
  phone_number: string

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

  @Column({
    type: "smallint",
    default: 1,
  })
  status: number

  @ManyToOne(() => Company)
  @JoinColumn({ name: "company_id" })
  company: Company
}
