'use client';

import { create } from 'zustand';
import { devtools } from 'zustand/middleware';
import { ReactNode } from 'react';
import { createTabActionsSlice } from '@/stores/tab-actions/slices/tab-actions.slice';

export type TabActionsSlice = {
  // State - actions per tab ID
  tabActions: Record<string, ReactNode>;

  // Actions
  setTabActions: (tabId: string, actions: ReactNode) => void;
  clearTabActions: (tabId: string) => void;
  clearAllTabActions: () => void;
};

export const useTabActionsStore = create<TabActionsSlice>()(
  devtools(
    (...args) => ({
      ...createTabActionsSlice(...args),
    }),
    {
      name: 'TabActionsStore',
    }
  )
);
