import { defineStore } from "pinia";
import { ref } from "vue";
import type { DataOption } from "@/interface/main";

export const useMainOptionDataStore = defineStore("MainOptionData", () => {
  const posLevelAuthorityOption = ref<DataOption[]>([
    {
      id: "HEAD",
      label: "หัวหน้าหน่วยงาน",
    },
    {
      id: "DEPUTY",
      label: "ปลัด",
    },
    {
      id: "GOVERNOR",
      label: "ผู้ว่าฯ",
    },
  ]);

  function posLevelAuthorityConvert(val: string) {
    return posLevelAuthorityOption.value.find((x: DataOption) => x.id === val)
      ?.label;
  }

  return {
    posLevelAuthorityOption,
    posLevelAuthorityConvert,
  };
});
