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

@Entity("company_settings")
export class CompanySetting extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number

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

  @Column({ type: "decimal", precision: 5, scale: 2, nullable: true })
  working_hours_per_day: number

  @Column({ type: "int", nullable: true })
  working_days_per_month: number

  @Column({ type: "int", nullable: true })
  break_minutes_per_day: number

  @Column({ type: "int", nullable: true })
  last_day_to_fill_mis_report: number

  @Column({ type: "text", nullable: true })
  notes: string | null

  @Column({ type: "varchar", length: 10, nullable: true })
  basic_salary_percentage: string

  @Column({ type: "int", nullable: true })
  final_approval_by: number

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