import { ref } from "vue";
import { defineStore } from "pinia";
import { useQuasar } from "quasar";

import { useCounterMixin } from "@/stores/mixin";

import type { DataOption } from "@/modules/10_registry/interface/index/Main";

const mixin = useCounterMixin();
const {} = mixin;

export const useGovernmentPosDataStore = defineStore("GovernmentPos", () => {
  //  commandCode ขอตำแหน่ง
  const positionCode = ref<number[]>([
    0, 1, 2, 3, 4, 8, 9, 10, 11, 12, 13, 14, 15, 16,
  ]);

  const commandCodeData = ref<DataOption[]>([]);

  function convertCommandCodeName(val: string) {
    return (
      commandCodeData.value.find((e: DataOption) => e.id === val)?.name ?? "-"
    );
  }

  return {
    // Data
    commandCodeData,
    positionCode,

    // Function
    convertCommandCodeName,
  };
});
