'use client';

import { type ComposioAppType, type LobehubSkillProviderType } from '@lobechat/const';
import type React from 'react';
import { createContext, use } from 'react';

export interface DetailContextValue {
  author: string;
  authorUrl?: string;
  config: ComposioAppType | LobehubSkillProviderType;
  description: string;
  icon: string | React.ComponentType<any>;
  identifier: string;
  isConnected: boolean;
  label: string;
  localizedDescription: string;
  localizedReadme: string;
  readme: string;
  serverName?: string;
  skillContent?: string;
  tools: Array<{ description?: string; inputSchema?: any; name: string }>;
  toolsLoading: boolean;
}

export const DetailContext = createContext<DetailContextValue | null>(null);

export const useDetailContext = () => {
  const context = use(DetailContext);
  if (!context) {
    throw new Error('useDetailContext must be used within DetailProvider');
  }
  return context;
};
