import { defineStore } from 'pinia'

interface locationType {
  sendParamsKey: string
  value: string
}
interface autoSelectType {
  sendParamsKey: string
  activeId: number
  label: string
  value: string
}

interface signType {
  sendParamsKey: string
  url: string
}
interface pharmacySelectType {
  sendParamsKey: string
  taskTypeId: string
  address: string
  area: string
  id: string
  pharmacyName: string
}

interface singleSelectByAddType {
  sendParamsKey: string
  taskTypeId: string
  name: string
}

interface singleSelectType {
  sendParamsKey: string
  taskTypeId: string
  data: any
}

interface signAddressInfoType {
  address: string
  locationId: string
  signTime: string
  checkOutTime: string
  signEntType: string
  longitude: string
  latitude: string
}

export const useTask = defineStore('task', {
  state() {
    return {
      location: null as locationType | null,
      autoSelect: null as autoSelectType | null,
      sign: null as signType | null,
      pharmacySelect: null as pharmacySelectType | null,
      singleSelecttByAdd: null as singleSelectByAddType | null,
      singleSelect: null as singleSelectType | null,
      signAddressInfo: null as signAddressInfoType | null
    }
  },
  actions: {
    setLocationSelect(location: locationType | null) {
      this.location = location
    },
    setAutoSelect(curr: autoSelectType | null) {
      this.autoSelect = curr
    },
    setSign(signInfo: signType | null) {
      this.sign = signInfo
    },
    setpPharmacySelect(info: pharmacySelectType | null) {
      this.pharmacySelect = info
    },
    setSingleSelectByAdd(info: singleSelectByAddType | null) {
      this.singleSelecttByAdd = info
    },
    setSingleSelect(data: singleSelectType | null) {
      this.singleSelect = data
    },
    setSignAddressInfo(data: signAddressInfoType | null) {
      this.signAddressInfo = data
    }
  }
})
