/**
 * api ระบบจัดการข้อมูลหลัก
 *  เมนูย่อย: ข้อมูลโครงสร้างหน่วยงาน
 */
import env from "../index";
const organizationMain = `${env.API_URI}/metadata/main/`;
const organization = `${env.API_URI}/metadata/organization/`;
const organizationOrganization = `${env.API_URI}/metadata/organization-organization/`;
const organizationShortName = `${env.API_URI}/metadata/organization-shortname/`;
const organizationCode = `${env.API_URI_ORG_SERVICE}/PositionMaster/`;
const organizationType = `${env.API_URI}/metadata/organization-type/`;
const organizationLevel = `${env.API_URI}/metadata/organization-level/`;
const organizationStatus = `${env.API_URI}/metadata/organization-status/`;
const organizationAgency = `${env.API_URI}/metadata/organization-agency/`;
const organizationGovernmentAgency = `${env.API_URI}/metadata/organization-government-agency/`;
const organizationTelExternal = `${env.API_URI}/metadata/organization-tel-external/`;
const organizationTelInternal = `${env.API_URI}/metadata/organization-tel-internal/`;
const organizationFax = `${env.API_URI}/metadata/organization-fax/`;
const dashbord = `${env.API_URI}/metadata/dashbord/`;

export default {
  /**
   * api จำนวนข้อมูลใน ระบบจัดการข้อมูลหลัก tab ย่อยแต่ละ tab
   */
  organizationMain: `${organizationMain}organization`,
  organization,
  countDashbordSubHistory: (type: number) => `${dashbord}${type}`,
  countDashbordHistory: `${dashbord}`,

  /**
   * api หน่วยงาน
   */
  organizationOrganization,
  listOrganizationOrganizationHistory: `${organizationOrganization}history`,
  listOrganizationOrganizationHistoryId: (id: string) =>
    `${organizationOrganization}history/${id}`,
  listOrganizationOrganizationPublished: `${organizationOrganization}history/published`,
  listOrganizationOrganizationPublishedHistory: `${organizationOrganization}history/published-history`,

  /**
   * api ชื่อย่อหน่วยงาน
   */
  organizationShortName,
  listOrganizationShortNameHistory: `${organizationShortName}history`,
  listOrganizationShortNameHistoryId: (id: string) =>
    `${organizationShortName}history/${id}`,
  listOrganizationShortNamePublished: `${organizationShortName}history/published`,
  listOrganizationShortNamePublishedHistory: `${organizationShortName}history/published-history`,
  organizationCode: `${organizationCode}organization-code`,
  organizationGovernmentCode: (id: string) =>
    `${organizationCode}government/${id}`,
  organizationAgencyCode: (id: string) => `${organizationCode}agency/${id}`,

  /**
   * api ประเภท
   */
  organizationType,
  listOrganizationTypeHistory: `${organizationType}history`,
  listOrganizationTypeHistoryId: (id: string) =>
    `${organizationType}history/${id}`,
  listOrganizationTypePublished: `${organizationType}history/published`,
  listOrganizationTypePublishedHistory: `${organizationType}history/published-history`,

  /**
   * api ระดับ
   */
  organizationLevel,
  listOrganizationLevelHistory: `${organizationLevel}history`,
  listOrganizationLevelHistoryId: (id: string) =>
    `${organizationLevel}history/${id}`,
  listOrganizationLevelPublished: `${organizationLevel}history/published`,
  listOrganizationLevelPublishedHistory: `${organizationLevel}history/published-history`,

  /**
   * api สถานะ
   */
  organizationStatus,
  listOrganizationStatusHistory: `${organizationStatus}history`,
  listOrganizationStatusHistoryId: (id: string) =>
    `${organizationStatus}history/${id}`,
  listOrganizationStatusPublished: `${organizationStatus}history/published`,
  listOrganizationStatusPublishedHistory: `${organizationStatus}history/published-history`,

  /**
   * api หน่วยงานต้นสังกัด
   */
  organizationAgency,
  listOrganizationAgencyHistory: `${organizationAgency}history`,
  listOrganizationAgencyHistoryId: (id: string) =>
    `${organizationAgency}history/${id}`,
  listOrganizationAgencyPublished: `${organizationAgency}history/published`,
  listOrganizationAgencyPublishedHistory: `${organizationAgency}history/published-history`,

  /**
   * api ส่วนราชการต้นสังกัด
   */
  organizationGovernmentAgency,
  listOrganizationGovernmentAgencyHistory: `${organizationGovernmentAgency}history`,
  listOrganizationGovernmentAgencyHistoryId: (id: string) =>
    `${organizationGovernmentAgency}history/${id}`,
  listOrganizationGovernmentAgencyPublished: `${organizationGovernmentAgency}history/published`,
  listOrganizationGovernmentAgencyPublishedHistory: `${organizationGovernmentAgency}history/published-history`,

  /**
   * api เบอร์ติดต่อภายนอก
   */
  organizationTelExternal,
  listOrganizationTelExternalHistory: `${organizationTelExternal}history`,
  listOrganizationTelExternalHistoryId: (id: string) =>
    `${organizationTelExternal}history/${id}`,
  listOrganizationTelExternalPublished: `${organizationTelExternal}history/published`,
  listOrganizationTelExternalPublishedHistory: `${organizationTelExternal}history/published-history`,

  /**
   * api เบอร์ติดต่อภายใน
   */
  organizationTelInternal,
  listOrganizationTelInternalHistory: `${organizationTelInternal}history`,
  listOrganizationTelInternalHistoryId: (id: string) =>
    `${organizationTelInternal}history/${id}`,
  listOrganizationTelInternalPublished: `${organizationTelInternal}history/published`,
  listOrganizationTelInternalPublishedHistory: `${organizationTelInternal}history/published-history`,

  /**
   * api เบอร์โทรสาร
   */
  organizationFax,
  listOrganizationFaxHistory: `${organizationFax}history`,
  listOrganizationFaxHistoryId: (id: string) =>
    `${organizationFax}history/${id}`,
  listOrganizationFaxPublished: `${organizationFax}history/published`,
  listOrganizationFaxPublishedHistory: `${organizationFax}history/published-history`,
};
