import { ProjectScopeConfig, TenantScopeConfig } from "../../db/manage/scope-definitions.js";
import { AppType, PaginationConfig } from "../../types/utility.js";
import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
import { AppInsert, AppSelect, AppUpdate } from "../../types/entities.js";

//#region src/data-access/runtime/apps.d.ts
declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promise<{
  type: AppType;
  id: string;
  name: string;
  description: string | null;
  createdAt: string;
  updatedAt: string;
  tenantId: string | null;
  projectId: string | null;
  enabled: boolean;
  prompt: string | null;
  config: {
    type: "web_client";
    webClient: {
      allowedDomains: string[];
      publicKeys: {
        kid: string;
        publicKey: string;
        algorithm: "EdDSA" | "ES256" | "ES512" | "RS256" | "RS384" | "RS512" | "ES384";
        addedAt: string;
      }[];
      allowAnonymous: boolean;
      audience?: string | undefined;
    };
  } | {
    type: "api";
    api: Record<string, never>;
  } | {
    type: "support_copilot";
    supportCopilot: {
      platform: string;
      credentialReferenceId?: string | undefined;
      quickActions?: {
        group: string;
        actions: {
          label: string;
          prompt: string;
        }[];
      }[] | undefined;
    };
  };
  lastUsedAt: string | null;
  defaultProjectId: string | null;
  defaultAgentId: string | null;
} | undefined>;
declare const updateAppLastUsed: (db: AgentsRunDatabaseClient) => (id: string) => Promise<void>;
declare const getAppByIdForTenant: (db: AgentsRunDatabaseClient) => (params: {
  scopes: TenantScopeConfig;
  id: string;
}) => Promise<AppSelect | undefined>;
declare const getAppByIdForProject: (db: AgentsRunDatabaseClient) => (params: {
  scopes: ProjectScopeConfig;
  id: string;
}) => Promise<AppSelect | undefined>;
declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
  scopes: TenantScopeConfig & {
    projectIds?: string[];
  };
  pagination?: PaginationConfig;
  type?: AppType;
}) => Promise<{
  data: AppSelect[];
  pagination: {
    page: number;
    limit: number;
    total: number;
    pages: number;
  };
}>;
declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) => Promise<{
  type: AppType;
  id: string;
  name: string;
  description: string | null;
  createdAt: string;
  updatedAt: string;
  tenantId: string | null;
  projectId: string | null;
  enabled: boolean;
  prompt: string | null;
  config: {
    type: "web_client";
    webClient: {
      allowedDomains: string[];
      publicKeys: {
        kid: string;
        publicKey: string;
        algorithm: "EdDSA" | "ES256" | "ES512" | "RS256" | "RS384" | "RS512" | "ES384";
        addedAt: string;
      }[];
      allowAnonymous: boolean;
      audience?: string | undefined;
    };
  } | {
    type: "api";
    api: Record<string, never>;
  } | {
    type: "support_copilot";
    supportCopilot: {
      platform: string;
      credentialReferenceId?: string | undefined;
      quickActions?: {
        group: string;
        actions: {
          label: string;
          prompt: string;
        }[];
      }[] | undefined;
    };
  };
  lastUsedAt: string | null;
  defaultProjectId: string | null;
  defaultAgentId: string | null;
}>;
declare const updateAppForTenant: (db: AgentsRunDatabaseClient) => (params: {
  scopes: TenantScopeConfig;
  id: string;
  data: AppUpdate;
}) => Promise<AppSelect | undefined>;
declare const updateAppForProject: (db: AgentsRunDatabaseClient) => (params: {
  scopes: ProjectScopeConfig;
  id: string;
  data: AppUpdate;
}) => Promise<AppSelect | undefined>;
declare const deleteAppForTenant: (db: AgentsRunDatabaseClient) => (params: {
  scopes: TenantScopeConfig;
  id: string;
}) => Promise<boolean>;
declare const deleteAppForProject: (db: AgentsRunDatabaseClient) => (params: {
  scopes: ProjectScopeConfig;
  id: string;
}) => Promise<boolean>;
declare const deleteAppsByProject: (db: AgentsRunDatabaseClient) => (tenantId: string, projectId: string) => Promise<number>;
declare const clearAppDefaultsByProject: (db: AgentsRunDatabaseClient) => (tenantId: string, projectId: string) => Promise<number>;
declare const clearAppDefaultsByAgent: (db: AgentsRunDatabaseClient) => (tenantId: string, agentId: string) => Promise<number>;
declare const getAppAuthKeysForProject: (db: AgentsRunDatabaseClient) => (params: {
  scopes: ProjectScopeConfig;
  id: string;
}) => Promise<{
  config: AppSelect["config"];
  type: AppSelect["type"];
} | undefined>;
declare const updateAppAuthKeysForProject: (db: AgentsRunDatabaseClient) => (params: {
  scopes: ProjectScopeConfig;
  id: string;
  config: AppSelect["config"];
}) => Promise<AppSelect | undefined>;
declare const updateApp: (db: AgentsRunDatabaseClient) => (params: {
  id: string;
  data: AppUpdate;
}) => Promise<{
  createdAt: string;
  updatedAt: string;
  id: string;
  tenantId: string | null;
  projectId: string | null;
  name: string;
  description: string | null;
  type: AppType;
  defaultProjectId: string | null;
  defaultAgentId: string | null;
  prompt: string | null;
  enabled: boolean;
  config: {
    type: "web_client";
    webClient: {
      allowedDomains: string[];
      publicKeys: {
        kid: string;
        publicKey: string;
        algorithm: "EdDSA" | "ES256" | "ES512" | "RS256" | "RS384" | "RS512" | "ES384";
        addedAt: string;
      }[];
      allowAnonymous: boolean;
      audience?: string | undefined;
    };
  } | {
    type: "api";
    api: Record<string, never>;
  } | {
    type: "support_copilot";
    supportCopilot: {
      platform: string;
      credentialReferenceId?: string | undefined;
      quickActions?: {
        group: string;
        actions: {
          label: string;
          prompt: string;
        }[];
      }[] | undefined;
    };
  };
  lastUsedAt: string | null;
}>;
declare const deleteApp: (db: AgentsRunDatabaseClient) => (id: string) => Promise<boolean>;
//#endregion
export { clearAppDefaultsByAgent, clearAppDefaultsByProject, createApp, deleteApp, deleteAppForProject, deleteAppForTenant, deleteAppsByProject, getAppAuthKeysForProject, getAppById, getAppByIdForProject, getAppByIdForTenant, listAppsPaginated, updateApp, updateAppAuthKeysForProject, updateAppForProject, updateAppForTenant, updateAppLastUsed };