import { defineStore } from 'pinia'
const useWorkFlowStore = defineStore(
  'workFlow',
  {
    state: () => ({
      tableId: '', // 审批id
      isTried: false,
      promoterDrawer: false,
      flowPermission1: {},
      approverDrawer: false, // 审批抽屉显示隐藏
      approverConfig1: {}, // 审批设置
      copyerDrawer: false,
      copyerConfig1: {},
      conditionDrawer: false,
      conditionsConfig1: {
        conditionNodes: [],
      },
    }),
    actions: {
      setTableId(payload: string) {
        this.tableId = payload
      },
      setIsTried(payload: boolean) {
        this.isTried = payload
      },
      setPromoter(payload: boolean) {
        this.promoterDrawer = payload
      },
      setFlowPermission(payload: object) {
        this.flowPermission1 = payload
      },
      // 审批抽屉显隐
      setApprover(payload: boolean) {
        this.approverDrawer = payload
      },
      // 审批设置
      setApproverConfig(payload: object) {
        this.approverConfig1 = payload
      },
      setCopyer(payload: boolean) {
        this.copyerDrawer = payload
      },
      setCopyerConfig(payload: object) {
        this.copyerConfig1 = payload
      },
      setCondition(payload: boolean) {
        this.conditionDrawer = payload
      },
      setConditionsConfig(payload: any) {
        this.conditionsConfig1 = payload
      },
    },
  },
)

export default useWorkFlowStore
