'use client';

import { create } from 'zustand';
import { devtools, persist } from 'zustand/middleware';

import { FormStore } from '@/types/stores';
import { createProductionStandardFormSlice } from '@/stores/form/slices/production-standard-form.slice';

export const useFormStore = create<FormStore>()(
  devtools(
    persist(
      (...args) => ({
        ...createProductionStandardFormSlice(...args),
      }),
      {
        name: 'production-standard-form-cache',
      }
    ),
    {
      name: 'FormStore',
    }
  )
);
