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

@Entity("profileFamilyMotherHistory")
export class ProfileFamilyMotherHistory extends EntityBase {
  @Column({
    nullable: true,
    default: null,
    comment: "คำนำหน้ามารดา",
  })
  motherPrefix: string;

  @Column({
    nullable: true,
    default: null,
    comment: "ชื่อมารดา",
  })
  motherFirstName: string;

  @Column({
    nullable: true,
    default: null,
    comment: "นามสกุลมารดา",
  })
  motherLastName: string;

  @Column({
    nullable: true,
    default: null,
    comment: "นามสกุลมารดาเดิม",
  })
  motherLastNameOld: string;

  @Column({
    nullable: true,
    default: null,
    comment: "อาชีพบิดา",
  })
  motherCareer: string;

  @Column({
    nullable: true,
    default: null,
    comment: "เลขที่บัตรประชาชนมารดา",
  })
  motherCitizenId: string;

  @Column({
    nullable: true,
    default: null,
    comment: "มีชีวิตมารดา",
  })
  motherLive: boolean;

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

  @ManyToOne(() => ProfileFamilyMother, (v) => v.histories)
  @JoinColumn({ name: "profileFamilyMotherId" })
  profileFamilyMother: ProfileFamilyMother;
}
