import { defineStore } from 'pinia'
import { ref } from 'vue'

// 场地信息
export const useInfoStore = defineStore(
  'big-info',
  () => {
    // 场馆 + 场地 基本信息
    const info = ref({})
    const setInfo = (obj) => {
      info.value = { ...obj }
    }
    // 预约信息（成功 or 失败）
    const responseInfo = ref({})
    const setResponseInfo = (obj) => {
      responseInfo.value = { ...obj }
    }
    // 订单信息
    const paymentInfo = ref({})
    const setPaymentInfo = (obj) => {
      paymentInfo.value = { ...obj }
    }
    return {
      info,
      responseInfo,
      paymentInfo,
      setInfo,
      setResponseInfo,
      setPaymentInfo
    }
  },
  {
    persist: true
  }
)
