import { AgentScopeConfig, SubAgentScopeConfig } from "../../db/manage/scope-definitions.js";
import { ConversationHistoryConfig, PaginationConfig, ToolMcpConfig, ToolServerCapabilities } from "../../types/utility.js";
import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
import "../../index.js";
import { SubAgentRelationInsert, SubAgentRelationUpdate, SubAgentToolRelationUpdate } from "../../types/entities.js";

//#region src/data-access/manage/subAgentRelations.d.ts
declare const getAgentRelationById: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  relationId: string;
}) => Promise<{
  id: string;
  createdAt: string;
  updatedAt: string;
  tenantId: string;
  projectId: string;
  agentId: string;
  sourceSubAgentId: string;
  targetSubAgentId: string | null;
  relationType: string | null;
} | undefined>;
declare const listAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  pagination?: PaginationConfig;
}) => Promise<{
  data: {
    createdAt: string;
    updatedAt: string;
    sourceSubAgentId: string;
    targetSubAgentId: string | null;
    relationType: string | null;
    agentId: string;
    projectId: string;
    tenantId: string;
    id: string;
  }[];
  pagination: {
    page: number;
    limit: number;
    total: number;
    pages: number;
  };
}>;
declare const getAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
  scopes: SubAgentScopeConfig;
}) => Promise<{
  id: string;
  createdAt: string;
  updatedAt: string;
  tenantId: string;
  projectId: string;
  agentId: string;
  sourceSubAgentId: string;
  targetSubAgentId: string | null;
  relationType: string | null;
}[]>;
declare const getAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
}) => Promise<{
  id: string;
  createdAt: string;
  updatedAt: string;
  tenantId: string;
  projectId: string;
  agentId: string;
  sourceSubAgentId: string;
  targetSubAgentId: string | null;
  relationType: string | null;
}[]>;
declare const getAgentRelationsBySource: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  sourceSubAgentId: string;
  pagination?: PaginationConfig;
}) => Promise<{
  data: {
    createdAt: string;
    updatedAt: string;
    sourceSubAgentId: string;
    targetSubAgentId: string | null;
    relationType: string | null;
    agentId: string;
    projectId: string;
    tenantId: string;
    id: string;
  }[];
  pagination: {
    page: number;
    limit: number;
    total: number;
    pages: number;
  };
}>;
declare const getSubAgentRelationsByTarget: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  targetSubAgentId: string;
  pagination?: PaginationConfig;
}) => Promise<{
  data: {
    createdAt: string;
    updatedAt: string;
    sourceSubAgentId: string;
    targetSubAgentId: string | null;
    relationType: string | null;
    agentId: string;
    projectId: string;
    tenantId: string;
    id: string;
  }[];
  pagination: {
    page: number;
    limit: number;
    total: number;
    pages: number;
  };
}>;
declare const getRelatedAgentsForAgent: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  subAgentId: string;
}) => Promise<{
  data: {
    id: string;
    name: string;
    description: string | null;
    relationType: string | null;
    relationId: string;
  }[];
}>;
declare const createSubAgentRelation: (db: AgentsManageDatabaseClient) => (params: SubAgentRelationInsert) => Promise<{
  id: string;
  createdAt: string;
  updatedAt: string;
  tenantId: string;
  projectId: string;
  agentId: string;
  sourceSubAgentId: string;
  targetSubAgentId: string | null;
  relationType: string | null;
}>;
/**
 * Check if sub-agent relation exists by agent, source, target, and relation type
 */
declare const getAgentRelationByParams: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  sourceSubAgentId: string;
  targetSubAgentId?: string;
  relationType: string;
}) => Promise<{
  id: string;
  createdAt: string;
  updatedAt: string;
  tenantId: string;
  projectId: string;
  agentId: string;
  sourceSubAgentId: string;
  targetSubAgentId: string | null;
  relationType: string | null;
} | undefined>;
/**
 * Upsert agent relation (create if it doesn't exist, no-op if it does)
 */
declare const upsertSubAgentRelation: (db: AgentsManageDatabaseClient) => (params: SubAgentRelationInsert) => Promise<{
  id: string;
  createdAt: string;
  updatedAt: string;
  tenantId: string;
  projectId: string;
  agentId: string;
  sourceSubAgentId: string;
  targetSubAgentId: string | null;
  relationType: string | null;
}>;
declare const updateAgentRelation: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  relationId: string;
  data: SubAgentRelationUpdate;
}) => Promise<{
  createdAt: string;
  updatedAt: string;
  sourceSubAgentId: string;
  targetSubAgentId: string | null;
  relationType: string | null;
  agentId: string;
  projectId: string;
  tenantId: string;
  id: string;
}>;
declare const deleteSubAgentRelation: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  relationId: string;
}) => Promise<boolean>;
declare const deleteAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
}) => Promise<boolean>;
declare const createAgentToolRelation: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  relationId?: string;
  data: {
    subAgentId: string;
    toolId: string;
    selectedTools?: string[] | null;
    headers?: Record<string, string> | null;
    toolPolicies?: Record<string, {
      needsApproval?: boolean;
    }> | null;
  };
}) => Promise<{
  id: string;
  createdAt: string;
  updatedAt: string;
  tenantId: string;
  projectId: string;
  agentId: string;
  toolId: string;
  headers: Record<string, string> | null;
  toolPolicies: Record<string, {
    needsApproval?: boolean;
  }> | null;
  subAgentId: string;
  selectedTools: string[] | null;
}>;
declare const updateAgentToolRelation: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  relationId: string;
  data: SubAgentToolRelationUpdate;
}) => Promise<{
  createdAt: string;
  updatedAt: string;
  toolId: string;
  selectedTools: string[] | null;
  headers: Record<string, string> | null;
  toolPolicies: Record<string, {
    needsApproval?: boolean;
  }> | null;
  subAgentId: string;
  agentId: string;
  projectId: string;
  tenantId: string;
  id: string;
}>;
declare const deleteAgentToolRelation: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  relationId: string;
}) => Promise<boolean>;
declare const deleteAgentToolRelationByAgent: (db: AgentsManageDatabaseClient) => (params: {
  scopes: SubAgentScopeConfig;
}) => Promise<boolean>;
declare const getAgentToolRelationById: (db: AgentsManageDatabaseClient) => (params: {
  scopes: SubAgentScopeConfig;
  relationId: string;
}) => Promise<{
  id: string;
  createdAt: string;
  updatedAt: string;
  tenantId: string;
  projectId: string;
  agentId: string;
  toolId: string;
  headers: Record<string, string> | null;
  toolPolicies: Record<string, {
    needsApproval?: boolean;
  }> | null;
  subAgentId: string;
  selectedTools: string[] | null;
} | undefined>;
declare const getAgentToolRelationByAgent: (db: AgentsManageDatabaseClient) => (params: {
  scopes: SubAgentScopeConfig;
  pagination?: PaginationConfig;
}) => Promise<{
  data: {
    createdAt: string;
    updatedAt: string;
    toolId: string;
    selectedTools: string[] | null;
    headers: Record<string, string> | null;
    toolPolicies: Record<string, {
      needsApproval?: boolean;
    }> | null;
    subAgentId: string;
    agentId: string;
    projectId: string;
    tenantId: string;
    id: string;
  }[];
  pagination: {
    page: number;
    limit: number;
    total: number;
    pages: number;
  };
}>;
declare const getAgentToolRelationByTool: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  toolId: string;
  pagination?: PaginationConfig;
}) => Promise<{
  data: {
    createdAt: string;
    updatedAt: string;
    toolId: string;
    selectedTools: string[] | null;
    headers: Record<string, string> | null;
    toolPolicies: Record<string, {
      needsApproval?: boolean;
    }> | null;
    subAgentId: string;
    agentId: string;
    projectId: string;
    tenantId: string;
    id: string;
  }[];
  pagination: {
    page: number;
    limit: number;
    total: number;
    pages: number;
  };
}>;
declare const listAgentToolRelations: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  pagination?: PaginationConfig;
}) => Promise<{
  data: {
    createdAt: string;
    updatedAt: string;
    toolId: string;
    selectedTools: string[] | null;
    headers: Record<string, string> | null;
    toolPolicies: Record<string, {
      needsApproval?: boolean;
    }> | null;
    subAgentId: string;
    agentId: string;
    projectId: string;
    tenantId: string;
    id: string;
  }[];
  pagination: {
    page: number;
    limit: number;
    total: number;
    pages: number;
  };
}>;
declare const getToolsForAgent: (db: AgentsManageDatabaseClient) => (params: {
  scopes: SubAgentScopeConfig;
  pagination?: PaginationConfig;
}) => Promise<{
  data: {
    id: string;
    tenantId: string;
    subAgentId: string;
    toolId: string;
    selectedTools: string[] | null;
    headers: Record<string, string> | null;
    toolPolicies: Record<string, {
      needsApproval?: boolean;
    }> | null;
    createdAt: string;
    updatedAt: string;
    tool: {
      id: string;
      name: string;
      description: string | null;
      config: {
        type: "mcp";
        mcp: ToolMcpConfig;
      };
      createdAt: string;
      updatedAt: string;
      capabilities: ToolServerCapabilities | null;
      lastError: string | null;
      credentialReferenceId: string | null;
      credentialScope: string;
      tenantId: string;
      projectId: string;
      headers: Record<string, string> | null;
      imageUrl: string | null;
    };
  }[];
  pagination: {
    page: number;
    limit: number;
    total: number;
    pages: number;
  };
}>;
declare const getAgentsForTool: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  toolId: string;
  pagination?: PaginationConfig;
}) => Promise<{
  data: {
    id: string;
    tenantId: string;
    subAgentId: string;
    toolId: string;
    selectedTools: string[] | null;
    headers: Record<string, string> | null;
    toolPolicies: Record<string, {
      needsApproval?: boolean;
    }> | null;
    createdAt: string;
    updatedAt: string;
    subAgent: {
      id: string;
      name: string;
      description: string | null;
      prompt: string | null;
      conversationHistoryConfig: ConversationHistoryConfig | null;
      models: {
        base?: {
          model?: string | undefined;
          providerOptions?: Record<string, unknown> | undefined;
          fallbackModels?: string[] | undefined;
          allowedProviders?: string[] | undefined;
        } | undefined;
        structuredOutput?: {
          model?: string | undefined;
          providerOptions?: Record<string, unknown> | undefined;
          fallbackModels?: string[] | undefined;
          allowedProviders?: string[] | undefined;
        } | undefined;
        summarizer?: {
          model?: string | undefined;
          providerOptions?: Record<string, unknown> | undefined;
          fallbackModels?: string[] | undefined;
          allowedProviders?: string[] | undefined;
        } | undefined;
      } | null;
      stopWhen: {
        stepCountIs?: number | undefined;
      } | null;
      createdAt: string;
      updatedAt: string;
    };
  }[];
  pagination: {
    page: number;
    limit: number;
    total: number;
    pages: number;
  };
}>;
declare const validateSubAgent: (db: AgentsManageDatabaseClient) => (params: {
  scopes: SubAgentScopeConfig;
}) => Promise<boolean>;
//#endregion
export { createAgentToolRelation, createSubAgentRelation, deleteAgentRelationsByAgent, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteSubAgentRelation, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByAgent, getAgentRelationsBySource, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsForTool, getRelatedAgentsForAgent, getSubAgentRelationsByTarget, getToolsForAgent, listAgentRelations, listAgentToolRelations, updateAgentRelation, updateAgentToolRelation, upsertSubAgentRelation, validateSubAgent };