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

@Entity("province")
export class Province extends EntityBase {
  @Column({
    nullable: true,
    comment: "จังหวัด",
    length: 255,
    default: null,
  })
  name: string;

  // @Column({
  //   comment: "mark",
  //   default: null,
  // })
  // importUpdate: number;

  // @Column({
  //   comment: "refId",
  //   default: null,
  // })
  // refId: number;

  @OneToMany(() => District, (district) => district.province)
  districts: District[];

  @OneToMany(() => Province, (province) => province.registrationProvinces)
  registrationProvinces: Province[];

  @OneToMany(() => Province, (province) => province.currentProvinces)
  currentProvinces: Province[];
}

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

export type UpdateProvince = Partial<CreateProvince>;
