import { defineStore } from "pinia";
import { ref } from "vue";
import type { NodeTree } from "../interface/response/Main";

export const usePermissionsStore = defineStore("permissions", () => {
  const typeOrganizational = ref<string>("current");
  const defaultOrganizationalNode = {
    labelName: "หน่วยงานทั้งหมด",
    orgCode: "",
    orgLevel: 0,
    orgName: "",
    orgRevisionId: "",
    orgRootName: "",
    orgTreeCode: "",
    orgTreeFax: "",
    orgTreeId: "",
    orgTreeName: "หน่วยงานทั้งหมด",
    orgTreeOrder: 0,
    orgTreePhoneEx: "",
    orgTreePhoneIn: "",
    orgTreeRank: "",
    orgTreeRankSub: "",
    orgTreeShortName: "",
    responsibility: "",
    totalPosition: 0,
    totalPositionCurrentUse: 0,
    totalPositionCurrentVacant: 0,
    totalPositionNextUse: 0,
    totalPositionNextVacant: 0,
    totalRootPosition: 0,
    totalRootPositionCurrentUse: 0,
    totalRootPositionCurrentVacant: 0,
    totalRootPositionNextUse: 0,
    totalRootPositionNextVacant: 0,
    children: [] as NodeTree[],
    isOfficer: false,
    orgRootDnaId: "",
    orgChild1DnaId: "",
    orgChild2DnaId: "",
    orgChild3DnaId: "",
    orgChild4DnaId: "",
  };

  const activeId = ref<string>("");
  const draftId = ref<string>("");
  return {
    typeOrganizational,
    activeId,
    draftId,
    defaultOrganizationalNode,
  };
});
