// Adjusting the store to handle SystemDropdownOption properly
import { create } from 'zustand';
import { Enterprise } from '../../components/SystemSelectionModal';

export type System = {
  id: number;
  name: string;
  logo: string;
};

export type SystemDropdownOption = {
  id: number;
  label: string;
  businessLabel: string;
  urlSlug: string;
  logo: string;
  enterprises?: Enterprise[];
};

type SystemStore = {
  currentSystem: SystemDropdownOption | null;
  setSystem: (system: SystemDropdownOption) => void;
  clearSystem: () => void;
};

export const useSystemStore = create<SystemStore>((set) => ({
  currentSystem: null,
  setSystem: (system: SystemDropdownOption) => set({ currentSystem: system }),
  clearSystem: () => set({ currentSystem: null }),
}));
