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

export interface PwoInfo {
  code: string;
  id: string | number;
  orderType: string;
  [key: string]: any;
}

export const usePwoStore = defineStore("pwo", () => {
  const pwoInfo = reactive<PwoInfo>({
    code: "",
    id: "",
    orderType: "",
  });

  function setInfo(info: PwoInfo) {
    Object.assign(pwoInfo, info);
  }

  function resetInfo() {
    Object.assign(pwoInfo, {});
  }

  return {
    pwoInfo,
    setInfo,
    resetInfo,
  };
});
