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

@Entity("salary_settings")
export class SalarySetting 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: 100, nullable: true })
  code: string

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

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

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

  @Column({ type: "smallint", default: 0 })
  is_taxable: number

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