import { BaseRecord, DataProvider } from '@refinedev/core';
import { Client } from '@urql/core';

/**
 * Custom response type for the Apito data provider
 */
type CustomResponse<TData = BaseRecord> = {
    data: TData;
};
/**
 * Extended data provider interface with Apito-specific methods
 */
type ExtendedDataProvider = DataProvider & {
    /**
     * Returns the GraphQL client instance
     */
    getApiClient: () => Client;
    /**
     * Returns the current API token
     */
    getToken: () => string;
    /**
     * Returns the API URL
     */
    getApiUrl: () => string;
};
/**
 * Type for a single response item from Apito
 */
type SingleResponseType = {
    id: string | undefined;
    data: any;
    meta?: {
        totalCount?: number;
        createdAt?: string;
        createdBy?: string;
    };
    total: number;
};
/**
 * Type for the response from Apito GraphQL API
 */
type ResponseType = {
    [key: string]: SingleResponseType;
};
/**
 * Type for Apito GraphQL errors
 */
type ApitoGraphQLError = {
    message: string;
    locations?: {
        line: number;
        column: number;
    }[];
    path?: string[];
};

declare const apitoDataProvider: (apiUrl: string, token: string, onTokenExpired?: () => void) => ExtendedDataProvider;

/**
 * A debug version of the Apito data provider that logs all method calls and their parameters.
 * This makes it easier to debug when the library is imported into another project.
 */
declare const debugApitoDataProvider: (apiUrl: string, token: string) => ExtendedDataProvider;

export { type ApitoGraphQLError, type CustomResponse, type ExtendedDataProvider, type ResponseType, type SingleResponseType, apitoDataProvider, debugApitoDataProvider };
