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

export const useDiseaseStore = defineStore(
  'disease',
  () => {
    // state
    const selectedSubCategoryIds = ref<number[]>([])

    // actions
    const setSelectedSubCategoryIds = (ids: number[]) => {
      selectedSubCategoryIds.value = ids
    }

    const clearSelectedSubCategoryIds = () => {
      selectedSubCategoryIds.value = []
    }

    // getters
    const getSelectedSubCategoryIds = () => {
      return selectedSubCategoryIds.value
    }

    return {
      selectedSubCategoryIds,
      setSelectedSubCategoryIds,
      clearSelectedSubCategoryIds,
      getSelectedSubCategoryIds,
    }
  },
  {
    persist: true, // 持久化选项
  },
)
