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

@Entity("commandRecive")
export class CommandRecive extends EntityBase {
  @Column({
    nullable: true,
    comment: "เลขประจำตัวประชาชน",
    length: 255,
    default: null,
  })
  citizenId: string;

  @Column({
    nullable: true,
    comment: "คำนำหน้า",
    length: 255,
    default: null,
  })
  prefix: string;

  @Column({
    nullable: true,
    comment: "ชื่อ",
    length: 255,
    default: null,
  })
  firstName: string;

  @Column({
    nullable: true,
    comment: "สกุล",
    length: 255,
    default: null,
  })
  lastName: string;

  @Column({
    nullable: true,
    comment: "ตำแหน่ง",
    length: 255,
    default: null,
  })
  position: string;

  @Column({
    nullable: true,
    comment: "เลขที่ตำแหน่ง",
    length: 255,
    default: null,
  })
  posNo: string;

  @Column({
    nullable: true,
    comment: "ประเภท",
    length: 255,
    default: null,
  })
  posType: string;

  @Column({
    nullable: true,
    comment: "ระดับ",
    length: 255,
    default: null,
  })
  posLevel: string;

  @Column({
    nullable: true,
    comment: "ลำดับแสดงผล",
    default: null,
  })
  order: number;

  @Column({
    nullable: true,
    comment: "หมายเหตุแนวตั้ง",
    type: "text",
    default: null,
  })
  remarkVertical: string;

  @Column({
    nullable: true,
    comment: "หมายเหตุแนวนอน",
    type: "text",
    default: null,
  })
  remarkHorizontal: string;

  @Column({
    comment: "เงินเดือนฐาน",
    default: 0,
    nullable: true,
    type: "double",
  })
  amount: Double;

  @Column({
    comment: "เงินพิเศษ",
    default: 0,
    nullable: true,
    type: "double",
  })
  amountSpecial: Double;

  @Column({
    comment: "เงินประจำตำแหน่ง",
    default: 0,
    nullable: true,
    type: "double",
  })
  positionSalaryAmount: Double;

  @Column({
    comment: "เงินค่าตอบแทนรายเดือน",
    default: 0,
    nullable: true,
    type: "double",
  })
  mouthSalaryAmount: Double;

  @Column({
    nullable: true,
    length: 40,
    comment: "refId",
    default: null,
  })
  refId: string;

  @Column({
    length: 40,
    comment: "คีย์นอก(FK)ของตาราง command",
  })
  commandId: string;

  @ManyToOne(() => Command, (command) => command.commandRecives)
  @JoinColumn({ name: "commandId" })
  command: Command;

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

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

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

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

export class CreateCommandRecive {
  @Column()
  name: string;
}

// export type UpdateCommandRecive = Partial<CreateCommandRecive>;
