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

@Entity("workflow")
export class Workflow extends EntityBase {
  @Column({
    nullable: true,
    comment: "refIdw",
    length: 255,
    default: null,
  })
  refId: string;

  @Column({
    nullable: true,
    comment: "ผู้ใช้งาน",
    length: 255,
    default: null,
  })
  profileType: string;

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

  @Column({
    nullable: true,
    comment: "ระบบ", //PLACEMENT
    length: 255,
    default: null,
  })
  category: string;

  @OneToMany(() => State, (state) => state.workflow)
  states: State[];

  @Column({
    nullable: true,
    comment: "ชื่อระบบ", //สอบคัดเลือก
    length: 100,
    default: null,
  })
  sysName: string;

  @Column({
    nullable: true,
    comment: "ชื่อระดับ",
    length: 100,
    default: null,
  })
  posLevelName: string;

  @Column({
    nullable: true,
    comment: "id state",
    length: 100,
    default: null,
  })
  stateId: string;

  @Column({
    nullable: true,
    comment: "ชื่อประเภท",
    length: 100,
    default: null,
  })
  posTypeName: string;

  @OneToMany(() => StateOperatorUser, (stateOperatorUser) => stateOperatorUser.workflow)
  stateOperatorUsers: StateOperatorUser[];
}
