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

@Entity("insigniaType")
export class InsigniaType extends EntityBase {
  @Column({
    nullable: true,
    comment: "ชื่อประเภทเครื่องราช",
    length: 255,
    default: null,
  })
  name: string;

  @Column({
    comment: "สถานะการใช้งาน",
    default: false,
  })
  isActive: boolean;

  @OneToMany(() => Insignia, (insignia) => insignia.insigniaType)
  insignias: Insignia[];
}

export class CreateInsigniaType {
  @Column()
  name: string;

  @Column()
  isActive: boolean;
}

export type UpdateInsigniaType = Partial<CreateInsigniaType>;
