/**
 * AgentType API Types
 *
 * These types mirror the backend Pydantic schemas for AgentType entities.
 * Used for type-safe API communication with the agent-types endpoints.
 */

/**
 * Base agent type fields shared across create, update, and response schemas
 */
export interface AgentTypeBase {
  name: string;
  slug: string;
  description?: string | null;
  expertise: string[];
  personality_prompt: string;
  primary_model: string;
  fallback_models: string[];
  model_params: Record<string, unknown>;
  mcp_servers: string[];
  tool_permissions: Record<string, unknown>;
  is_active: boolean;
}

/**
 * Schema for creating a new agent type
 */
export interface AgentTypeCreate {
  name: string;
  slug: string;
  description?: string | null;
  expertise?: string[];
  personality_prompt: string;
  primary_model: string;
  fallback_models?: string[];
  model_params?: Record<string, unknown>;
  mcp_servers?: string[];
  tool_permissions?: Record<string, unknown>;
  is_active?: boolean;
}

/**
 * Schema for updating an existing agent type
 */
export interface AgentTypeUpdate {
  name?: string | null;
  slug?: string | null;
  description?: string | null;
  expertise?: string[] | null;
  personality_prompt?: string | null;
  primary_model?: string | null;
  fallback_models?: string[] | null;
  model_params?: Record<string, unknown> | null;
  mcp_servers?: string[] | null;
  tool_permissions?: Record<string, unknown> | null;
  is_active?: boolean | null;
}

/**
 * Schema for agent type API responses
 */
export interface AgentTypeResponse {
  id: string;
  name: string;
  slug: string;
  description: string | null;
  expertise: string[];
  personality_prompt: string;
  primary_model: string;
  fallback_models: string[];
  model_params: Record<string, unknown>;
  mcp_servers: string[];
  tool_permissions: Record<string, unknown>;
  is_active: boolean;
  created_at: string;
  updated_at: string;
  instance_count: number;
}

/**
 * Pagination metadata for list responses
 */
export interface PaginationMeta {
  total: number;
  page: number;
  page_size: number;
  total_pages: number;
  has_next: boolean;
  has_prev: boolean;
}

/**
 * Schema for paginated agent type list responses
 */
export interface AgentTypeListResponse {
  data: AgentTypeResponse[];
  pagination: PaginationMeta;
}

/**
 * Query parameters for listing agent types
 */
export interface AgentTypeListParams {
  page?: number;
  limit?: number;
  is_active?: boolean;
  search?: string;
}

/**
 * Model parameter configuration with typed fields
 */
export interface ModelParams {
  temperature?: number;
  max_tokens?: number;
  top_p?: number;
  [key: string]: unknown;
}

/**
 * MCP permission scope configuration
 */
export interface McpPermission {
  id: string;
  name: string;
  enabled: boolean;
  scopes: string[];
}

/**
 * Tool permission entry
 */
export interface ToolPermission {
  tool_id: string;
  enabled: boolean;
  scopes?: string[];
}
