import { create } from 'zustand';

// AI Model interface definition
export interface AIModel {
  id: string;
  name: string;
  description?: string | null;
  model_type: string;
  version: string;
  status: 'active' | 'inactive' | 'training' | 'error';
  created_at: string;
  updated_at: string;
  parameters?: Record<string, any> | null;
}

// AI Model state interface
export interface AIModelState {
  models: AIModel[];
  currentModel: AIModel | null;

  // Actions
  setModels: (models: AIModel[]) => void;
  setCurrentModel: (model: AIModel | null) => void;

  // Getters
  getModels: () => AIModel[];
  getCurrentModel: () => AIModel | null;
}

// Create AI Model store
export const useAIModelStore = create<AIModelState>((set, get) => ({
  models: [],
  currentModel: null,

  setModels: (models: AIModel[]) => {
    set({ models });
  },

  setCurrentModel: (model: AIModel | null) => {
    set({ currentModel: model });
  },

  getModels: () => {
    return get().models;
  },

  getCurrentModel: () => {
    return get().currentModel;
  },
}));

export default useAIModelStore;