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

@Entity("mis_reports")
export class MisReport extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number

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

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

  @Column({
    type: "varchar",
    length: 50,
    nullable: false,
    default: "pending",
  })
  status: string

  @Column({ type: "smallint", nullable: false })
  month: number

  @Column({ type: "smallint", nullable: false })
  year: number

  @Column({ type: "text", nullable: true })
  business_tasks: string

  @Column({ type: "text", nullable: true })
  technical_tasks: string

  @Column({ type: "text", nullable: true })
  personal_tasks: string

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

  @ManyToOne(() => Employee)
  @JoinColumn({ name: "employee_id" })
  employee: Employee
}
