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

import type { FormDataDetail } from "@/modules/18_command/interface/request/Main";

export const useCommandDetail = defineStore("commandDetailStore", () => {
  const readonly = ref<boolean>(false);
  const dataCommand = ref<FormDataDetail>();
  const status = ref<string>("");
  const isSalary = ref<boolean>(false)
  function checkStep(val: string) {
    status.value = val;
    switch (val) {
      case "DRAFT":
        return 1;
      case "PENDING":
        return 2;
      case "WAITING":
        return 3;
      case "REPORTED":
        return 5;
      case "NEW":
        return 1;
      default:
        return 0;
    }
  }

  const classInput = (val: boolean) => {
    return {
      "full-width inputgreen cursor-pointer": val,
      "full-width cursor-pointer": !val,
    };
  };

  return {
    checkStep,
    classInput,
    readonly,
    status,
    dataCommand,
    isSalary
  };
});
