'use client';

import { create } from 'zustand';
import { devtools, persist } from 'zustand/middleware';
import { createDashboardFilterSlice } from '@/stores/dashboard/slices/dashboard-filter.slice';
import { DashboardFilterSlice } from '@/types/stores';

export type DashboardStore = DashboardFilterSlice;

export const useDashboardStore = create<DashboardStore>()(
  devtools(
    persist(
      (...args) => ({
        ...createDashboardFilterSlice(...args),
      }),
      {
        name: 'dashboard-filter-cache',
      }
    ),
    {
      name: 'DashboardStore',
    }
  )
);
