import { Entity, Column, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { ProfileChangePosition } from "./ProfileChangePosition";

@Entity("changePosition")
export class ChangePosition extends EntityBase {
  @Column({
    nullable: true,
    comment: "ชื่อรอบการย้ายสับเปลี่ยนตำแหน่ง",
    type: "text",
    default: null,
  })
  name: string;

  @Column({
    nullable: true,
    type: "datetime",
    comment: "วันที่ดำเนินการ",
    default: null,
  })
  date: Date;

  @Column({
    nullable: true,
    comment: "สถานะ",
    type: "text",
    default: null,
  })
  status: string;

  @OneToMany(() => ProfileChangePosition, (x) => x.profile)
  profileChangePosition: ProfileChangePosition[];
}

export class CreateChangePosition {
  name: string;
  date?: Date;
  status?: string;
}

export type UpdateChangePosition = {
  name: string;
  date?: Date;
  status?: string;
};
