import { defineStore } from 'pinia'
import { ref } from 'vue'
import type { ReturnApprovalAssetDTO } from '@/common/apis/approval/type'

export interface ApprovalDetail extends ReturnApprovalAssetDTO {
  goodsName: string
  coverImg: string
}

export const useApprovalStore = defineStore('approval', () => {
  const currentApproval = ref<ApprovalDetail | null>(null)

  const setCurrentApproval = (approval: ApprovalDetail) => {
    currentApproval.value = approval
  }

  return {
    currentApproval,
    setCurrentApproval
  }
})

export function useApprovalStoreOutside() {
  return useApprovalStore()
}