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

import type { DataLeaveType } from "@/modules/09_leave/interface/response/leaveHistory";

export const useLeaveHistoryDataStore = defineStore("leaveHistory", () => {
  const leaveTypeData = ref<DataLeaveType[]>([
    {
      id: "00000000-0000-0000-0000-000000000000",
      name: "ทั้งหมด",
    },
  ]);

  /**
   *
   * @param date
   * @returns
   */
  function findYear(date: Date) {
    const month = date.getMonth() + 1;
    return month >= 10 ? date.getFullYear() + 1 : date.getFullYear();
  }

  return {
    leaveTypeData,
    findYear,
  };
});
