import { Entity, Column, OneToMany, JoinColumn, ManyToOne, Double } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
import { Command } from "./Command";
import { ProfileSalary } from "./ProfileSalary";

@Entity("positionSalaryEditHistory")
export class PositionSalaryEditHistory extends EntityBase {
  @Column({
    nullable: true,
    length: 40,
    comment: "คีย์นอก(FK)ของตาราง profile",
    type: "uuid",
    default: null,
  })
  profileId: string;

  @Column({
    nullable: true,
    length: 40,
    comment: "คีย์นอก(FK)ของตาราง profileEmployee",
    type: "uuid",
    default: null,
  })
  profileEmployeeId: string;

  @Column({
    comment: "วันที่ตีกลับ",
    type: "datetime",
    nullable: true,
  })
  returnedDate: Date;
  
  @Column({
    nullable: true,
    comment: "ชื่อผู้ตรวจสอบ",
    default: null,
  })
  examinerName: string;

  @Column({
    nullable: true,
    comment: "รายละเอียดที่แจ้งให้แก้ไข",
    default: null,
  })
  detailForEdit: string;

  @ManyToOne(() => Profile, (profile) => profile.positionSalaryEditHistory)
  @JoinColumn({ name: "profileId" })
  profile: Profile;

  @ManyToOne(() => ProfileEmployee, (profileEmployee) => profileEmployee.positionSalaryEditHistory)
  @JoinColumn({ name: "profileEmployeeId" })
  profileEmployee: ProfileEmployee;

}

export class CreatePositionSalaryEditHistory {
  detailForEdit: string | null;
}

