import { ref } from "vue";
interface Pagination {
  rowsPerPage: number;
}

interface DataDateMonthObject {
  month: number;
  year: number;
}

interface ChangeActive {
  name: string;
  id: number;
}

//ข้อมูลส่วนตัว
interface Information {
  cardid: string | null;
  prefix: string | null;
  prefixId: string | null;
  firstname: string | null;
  lastname: string | null;
  birthDate: Date | null;
  genderId: string | null;
  bloodId: string | null;
  nationality: string | null;
  ethnicity: string | null;
  religionId: string | null;
  tel: string | null;
  phone: string | null;
  email: string | null;
  province: string | null;
  provinceId: string | null;
  districtId: string | null;
  cardIdDate: Date | null;
  relationshipId: string | null;
  statusId: string | null;
  knowledge: string | null;
  profileImg: string | null;
}

interface Family {
  prefixC: string | null; // couple
  prefixIdC: string | null;
  firstnameC: string | null;
  lastnameC: string | null;
  occupationC: string | null;
  nationalityC: string | null;
  prefixM: string | null; // male
  prefixIdM: string | null;
  firstnameM: string | null;
  lastnameM: string | null;
  occupationM: string | null;
  nationalityM: string | null;
  prefixF: string | null; // female
  prefixIdF: string | null;
  firstnameF: string | null;
  lastnameF: string | null;
  occupationF: string | null;
  nationalityF: string | null;
  same: string | null;
}

interface Occupation {
  status: string | null;
  company: string | null;
  department: string | null;
  email: string | null;
  tel: string | null;
  official: string | null;
  personnel: string | null;
  officialsOther: string | null;
  employee: string | null;
  other: string | null;
}

interface Address {
  address: string | null;
  provinceId: string | null;
  districtId: string | null;
  subdistrictId: string | null;
  code?: number | null;
  addressC: string | null;
  provinceIdC: string | null;
  districtIdC: string | null;
  subdistrictIdC: string | null;
  codeC?: number | null;
  same: string | null;
}

interface DataOption {
  id: string;
  name: string;
  zipCode?: number | null;
}

interface zipCodeOption {
  id: string;
  name: string;
  zipCode: string | null;
}

interface UploadType {
  id: string;
  fileName: string;
  fileSize: number;
  fileType: string;
  detail: string;
}

interface WebType {
  by: string;
  thai: string;
  eng: string;
  descripstion: string;
}

interface AddressWeb {
  address: string | null;
  provinceId: string | null;
  districtId: string | null;
  subdistrictId: string | null;
  tel: string | null;
  code: string | null;
}

interface EnableType {
  photo: boolean;
  web: boolean;
  about: boolean;
}

interface CmsTable {
  id: string;
  name: string;
  link: string;
  createdAt: Date;
  lastUpdatedAt: Date;
}

interface ExamCard {
  id: string;
  title: string;
  announcementDate: Date;
  registerRound: Number;
  registerDateStart: Date;
  registerDateEnd: Date;
  yearly: Date;
}

const defaultCard: ExamCard[] = [
  {
    id: "1",
    title: "การสอบภาค ข. พิเศษ สำหรับผู้สอบผ่านของส่วนราชการแล้ว",
    registerRound: 2,
    announcementDate: new Date("2022-11-23"),
    registerDateStart: new Date("2022-11-09"),
    registerDateEnd: new Date("2022-11-10"),
    yearly: new Date("2022-01-01"),
  },
  {
    id: "2",
    title: "การสอบภาค ก. พิเศษ สำหรับผู้สอบผ่านของส่วนราชการแล้ว",
    registerRound: 1,
    announcementDate: new Date("2022-10-14"),
    registerDateStart: new Date("2022-10-09"),
    registerDateEnd: new Date("2022-11-30"),
    yearly: new Date("2022-01-01"),
  },
  {
    id: "2",
    title: "การสอบภาค ก. พิเศษ สำหรับผู้สอบผ่านของส่วนราชการแล้ว",
    registerRound: 1,
    announcementDate: new Date("2022-10-14"),
    registerDateStart: new Date("2022-10-09"),
    registerDateEnd: new Date("2022-11-30"),
    yearly: new Date("2022-01-01"),
  },
  {
    id: "2",
    title: "การสอบภาค ก. พิเศษ สำหรับผู้สอบผ่านของส่วนราชการแล้ว",
    registerRound: 1,
    announcementDate: new Date("2022-10-14"),
    registerDateStart: new Date("2022-10-09"),
    registerDateEnd: new Date("2022-11-30"),
    yearly: new Date("2022-01-01"),
  },
  {
    id: "2",
    title: "การสอบภาค ก. พิเศษ สำหรับผู้สอบผ่านของส่วนราชการแล้ว",
    registerRound: 1,
    announcementDate: new Date("2022-10-14"),
    registerDateStart: new Date("2022-10-09"),
    registerDateEnd: new Date("2022-11-30"),
    yearly: new Date("2022-01-01"),
  },
  {
    id: "2",
    title: "การสอบภาค ก. พิเศษ สำหรับผู้สอบผ่านของส่วนราชการแล้ว",
    registerRound: 1,
    announcementDate: new Date("2022-10-14"),
    registerDateStart: new Date("2022-10-09"),
    registerDateEnd: new Date("2022-11-30"),
    yearly: new Date("2022-01-01"),
  },
  {
    id: "2",
    title: "การสอบภาค ก. พิเศษ สำหรับผู้สอบผ่านของส่วนราชการแล้ว",
    registerRound: 1,
    announcementDate: new Date("2022-10-14"),
    registerDateStart: new Date("2022-10-09"),
    registerDateEnd: new Date("2022-11-30"),
    yearly: new Date("2022-01-01"),
  },
  {
    id: "2",
    title: "การสอบภาค ก. พิเศษ สำหรับผู้สอบผ่านของส่วนราชการแล้ว",
    registerRound: 1,
    announcementDate: new Date("2022-10-14"),
    registerDateStart: new Date("2022-10-09"),
    registerDateEnd: new Date("2022-11-30"),
    yearly: new Date("2022-01-01"),
  },
  {
    id: "2",
    title: "การสอบภาค ก. พิเศษ สำหรับผู้สอบผ่านของส่วนราชการแล้ว",
    registerRound: 1,
    announcementDate: new Date("2022-10-14"),
    registerDateStart: new Date("2022-10-09"),
    registerDateEnd: new Date("2022-11-30"),
    yearly: new Date("2022-01-01"),
  },
  {
    id: "2",
    title: "การสอบภาค ก. พิเศษ สำหรับผู้สอบผ่านของส่วนราชการแล้ว",
    registerRound: 1,
    announcementDate: new Date("2022-10-14"),
    registerDateStart: new Date("2022-10-09"),
    registerDateEnd: new Date("2022-11-30"),
    yearly: new Date("2022-01-01"),
  },
];

const defaultAddress = ref<Address>({
  address: null,
  provinceId: null,
  districtId: null,
  subdistrictId: null,
  //   code: ,
  addressC: null,
  provinceIdC: null,
  districtIdC: null,
  subdistrictIdC: null,
  //   codeC: ,
  same: "1",
});

const defaultInformation = ref<Information>({
  cardid: null,
  prefix: null,
  prefixId: null,
  firstname: null,
  lastname: null,
  birthDate: new Date(),
  genderId: null,
  bloodId: null,
  nationality: null,
  ethnicity: null,
  religionId: null,
  tel: null,
  phone: null,
  email: null,
  province: null,
  cardIdDate: new Date(),
  relationshipId: null,
  knowledge: null,
  districtId: null,
  provinceId: null,
  statusId: null,
  profileImg: null,
});

const defaultFamily = ref<Family>({
  prefixC: null,
  prefixIdC: null,
  firstnameC: null,
  lastnameC: null,
  occupationC: null,
  nationalityC: null,
  prefixM: null,
  prefixIdM: null,
  firstnameM: null,
  lastnameM: null,
  occupationM: null,
  nationalityM: null,
  prefixF: null,
  prefixIdF: null,
  firstnameF: null,
  lastnameF: null,
  occupationF: null,
  nationalityF: null,
  same: "0",
});

const defaultOccupation = ref<Occupation>({
  status: null,
  company: null,
  department: null,
  email: null,
  tel: null,
  official: null,
  personnel: null,
  officialsOther: null,
  employee: null,
  other: null,
});

const changeData = (system: String, val: any) => {
  if (system == "information") defaultInformation.value = val;
  if (system == "address") defaultAddress.value = val;
  if (system == "famliy") defaultFamily.value = val;
  if (system == "occupation") defaultOccupation.value = val;
};

export {
  defaultInformation,
  defaultFamily,
  defaultAddress,
  defaultOccupation,
  defaultCard,
  changeData,
};
export type {
  Pagination,
  DataOption,
  DataDateMonthObject,
  ChangeActive,
  Information,
  Family,
  Address,
  zipCodeOption,
  Occupation,
  ExamCard,
  UploadType,
  WebType,
  AddressWeb,
  EnableType,
  CmsTable,
};
