/**
 * api ระบบจัดการข้อมูลหลัก
 *  เมนูย่อย: ข้อมูลเกี่ยวกับบุคคล
 */
import env from "../index";
const person = `${env.API_URI}/metadata/main/`;
const province = `${env.API_URI}/metadata/province/`;
const district = `${env.API_URI}/metadata/district/`;
const subDistrict = `${env.API_URI}/metadata/sub-district/`;
const prefix = `${env.API_URI}/metadata/prefix/`;
const bloodGroup = `${env.API_URI}/metadata/blood-group/`;
const educationLevel = `${env.API_URI}/metadata/education-level/`;
const gender = `${env.API_URI}/metadata/gender/`;
const relationship = `${env.API_URI}/metadata/relationship/`;
const religion = `${env.API_URI}/metadata/religion/`;

export default {
  person: `${person}person`,

  /**
   * api จังหวัด
   */
  province,
  listProvinceHistory: `${province}history`,
  listProvinceHistoryId: (id: string) => `${province}history/${id}`,
  listProvincePublished: `${province}history/published`,
  listProvincePublishedHistory: `${province}history/published-history`,

  /**
   * api เขต
   */
  listDistrict: (id: string) => `${district}${id}`,
  listDistrictHistory: `${district}history`,
  listDistrictHistoryId: (id: string | string[]) => `${district}history/${id}`,
  listDistrictPublishedId: (id: string) => `${district}history/published/${id}`,
  listDistrictPublishedHistory: (id: string | string[]) =>
    `${district}history/published-history/${id}`,

  /**
   * api แขวง
   */
  listSubDistrict: (id: string) => `${subDistrict}${id}`,
  listSubDistrictHistory: `${subDistrict}history`,
  listSubDistrictHistoryProvinceId: (
    provinceId: string | string[],
    district: string | string[]
  ) => `${subDistrict}history/${provinceId}/${district}`,
  listSubDistrictHistoryId: (id: string | string[]) =>
    `${subDistrict}history/${id}`,
  listSubDistrictPublishedId: (id: string) =>
    `${subDistrict}history/published/${id}`,
  listSubDistrictPublishedHistory: (id: string | string[]) =>
    `${subDistrict}history/published-history/${id}`,

  /**
   * api คำนำหน้าชื่อ
   */
  prefix,
  listPrefixHistory: `${prefix}history`,
  listPrefixHistoryId: (id: string) => `${prefix}history/${id}`,
  listPrefixPublished: `${prefix}history/published`,
  listPrefixPublishedHistory: `${prefix}history/published-history`,

  /**
   * api เพศ
   */
  gender,
  listGenderHistory: `${gender}history`,
  listGenderHistoryId: (id: string) => `${gender}history/${id}`,
  listGenderPublished: `${gender}history/published`,
  listGenderPublishedHistory: `${gender}history/published-history`,

  /**
   * api สถานภาพ
   */
  relationship,
  listRelationshipHistory: `${relationship}history`,
  listRelationshipHistoryId: (id: string) => `${relationship}history/${id}`,
  listRelationshipPublished: `${relationship}history/published`,
  listRelationshipPublishedHistory: `${relationship}history/published-history`,

  /**
   * api กลุ่มเลือด
   */
  bloodGroup,
  listBloodGroupHistory: `${bloodGroup}history`,
  listBloodGroupHistoryId: (id: string) => `${bloodGroup}history/${id}`,
  listBloodGroupPublished: `${bloodGroup}history/published`,
  listBloodGroupPublishedHistory: `${bloodGroup}history/published-history`,

  /**
   * api ศาสนา
   */
  religion,
  listReligionHistory: `${religion}history`,
  listReligionHistoryId: (id: string) => `${religion}history/${id}`,
  listReligionPublished: `${religion}history/published`,
  listReligionPublishedHistory: `${religion}history/published-history`,

  /**
   * api ระดับการศึกษา
   */
  educationLevel,
  listEducationLevelHistory: `${educationLevel}history`,
  listEducationLevelHistoryId: (id: string) => `${educationLevel}history/${id}`,
  listEducationLevelPublished: `${educationLevel}history/published`,
  listEducationLevelPublishedHistory: `${educationLevel}history/published-history`,
};
