import { ZodRawShape, z, ZodTypeAny } from 'zod';
import { ToolAnnotations } from '@modelcontextprotocol/sdk/types';
import { ApiClient, ApiClientConfig } from '@mondaydotcomorg/api';

type SessionContext = {
    metadata?: Record<string, unknown>;
};
interface Executable<Input, Output> {
    execute: (input?: Input, sessionContext?: SessionContext) => Promise<Output>;
}

type ToolInputType<Input extends ZodRawShape | undefined> = Input extends ZodRawShape ? z.objectOutputType<Input, ZodTypeAny> : undefined;
type ToolOutputType<T extends Record<string, unknown>> = {
    content: string | Record<string, any>;
    metadata?: T;
};
declare enum ToolType {
    READ = "read",
    WRITE = "write",
    ALL_API = "all_api"
}
interface Tool<Input extends ZodRawShape | undefined, Output extends Record<string, unknown> = never> extends Executable<ToolInputType<Input>, ToolOutputType<Output>> {
    name: string;
    type: ToolType;
    annotations: ToolAnnotations;
    /** Whether the tool is enabled by default. Defaults to true if not specified. */
    enabledByDefault?: boolean;
    getDescription(): string;
    getInputSchema(): Input;
}

type MondayApiToolContext = {
    boardId?: number;
    apiVersion?: string;
    agentType?: string;
    agentClientName?: string;
    clientRedirectUris?: string[];
};
type BaseMondayApiToolConstructor = new (api: ApiClient) => BaseMondayApiTool<any>;
declare abstract class BaseMondayApiTool<Input extends ZodRawShape | undefined, Output extends Record<string, unknown> = never> implements Tool<Input, Output> {
    protected readonly mondayApi: ApiClient;
    protected readonly context?: MondayApiToolContext | undefined;
    abstract name: string;
    abstract type: ToolType;
    abstract annotations: ToolAnnotations;
    enabledByDefault?: boolean;
    protected sessionContext: SessionContext;
    constructor(mondayApi: ApiClient, context?: MondayApiToolContext | undefined);
    abstract getDescription(): string;
    abstract getInputSchema(): Input;
    /**
     * Public execute method
     */
    execute(input?: ToolInputType<Input>, sessionContext?: SessionContext): Promise<ToolOutputType<Output>>;
    /**
     * Abstract method that subclasses should implement for their actual logic
     */
    protected abstract executeInternal(input?: ToolInputType<Input>): Promise<ToolOutputType<Output>>;
}

declare enum MondayAppsToolCategory {
    APP = "app",
    APP_VERSION = "app_version",
    APP_FEATURE = "app_feature",
    STORAGE = "storage",
    MONDAY_CODE = "monday_code",
    APP_DEVELOPMENT_ASSISTANT = "app_development_assistant"
}

interface MondayApiResponse {
    statusCode: number;
    headers?: Record<string, string>;
    [key: string]: any;
}
type MondayAppsToolType = new (mondayApiToken?: string) => BaseMondayAppsTool<any, any>;
declare abstract class BaseMondayAppsTool<Input extends ZodRawShape | undefined, Output extends Record<string, unknown> = never> implements Tool<Input, Output> {
    abstract name: string;
    abstract type: ToolType;
    abstract category: MondayAppsToolCategory;
    private mondayApiToken?;
    abstract annotations: ToolAnnotations;
    constructor(mondayApiToken?: string);
    abstract getDescription(): string;
    abstract getInputSchema(): Input;
    /**
     * Public execute method that automatically tracks execution
     */
    execute(input?: ToolInputType<Input>): Promise<ToolOutputType<Output>>;
    /**
     * Abstract method that subclasses should implement for their actual logic
     */
    protected abstract executeInternal(input?: ToolInputType<Input>): Promise<ToolOutputType<Output>>;
    /**
     * Execute an API request to the monday.com  API
     */
    protected executeApiRequest<T extends MondayApiResponse>(method: string, endpoint: string, options?: {
        data?: any;
        query?: Record<string, any>;
        headers?: Record<string, string>;
        timeout?: number;
    }): Promise<T>;
    protected executeGraphQLQuery<T>(query: string, variables?: Record<string, unknown>): Promise<T>;
    /**
     * Tracks tool execution with timing and error information
     * @param toolName - The name of the tool being executed
     * @param executionTimeInMs - The time taken to execute the tool in milliseconds
     * @param isError - Whether the execution resulted in an error
     * @param params - The parameters passed to the tool
     */
    private trackToolExecution;
}

declare const allMondayAppsTools: MondayAppsToolType[];

declare const allMondayDevTools: BaseMondayApiToolConstructor[];

declare const allGraphqlApiTools: BaseMondayApiToolConstructor[];

declare const allTools: (MondayAppsToolType | BaseMondayApiToolConstructor)[];

declare enum ToolMode {
    API = "api",
    APPS = "apps",
    ATP = "atp"
}
type ToolsConfiguration = {
    include?: string[];
    exclude?: string[];
    readOnlyMode?: boolean;
    mode?: ToolMode;
    enableDynamicApiTools?: boolean | 'only';
    enableToolManager?: boolean;
};
type MondayAgentToolkitConfig = {
    mondayApiToken: ApiClientConfig['token'];
    mondayApiVersion?: ApiClientConfig['apiVersion'];
    mondayApiEndpoint?: ApiClientConfig['endpoint'];
    mondayApiRequestConfig?: ApiClientConfig['requestConfig'];
    toolsConfiguration?: ToolsConfiguration;
    context?: MondayApiToolContext;
};

export { Executable, MondayAgentToolkitConfig, SessionContext, Tool, ToolInputType, ToolMode, ToolOutputType, ToolType, ToolsConfiguration, allGraphqlApiTools, allMondayAppsTools, allMondayDevTools, allTools };
