import { inspect, InspectOptions } from "util";
import TokenPage, { TokenPaginationPayload } from "../../../base/TokenPage";
import Response from "../../../http/response";
import V3 from "../V3";
import { ApiResponse } from "../../../base/ApiResponse";
export declare class InsightsQueryRequest {
    /**
     * The business domain to execute the query against
     */
    "domain"?: string;
    "query": QueryDefinition;
    constructor(payload: any);
}
/**
 * Valid status values for long-running operations.
 */
export type LongRunningOperationStatus = "PENDING" | "RUNNING" | "CANCELLED" | "COMPLETED" | "FAILED";
/**
 * Error details for a failed operation, embedded inside a 200 OK operation envelope.
 */
export declare class OperationError {
    /**
     * Twilio-specific error code
     */
    "code": number;
    /**
     * A human readable error message
     */
    "message": string;
    /**
     * HTTP status code that would have been returned for a synchronous failure
     */
    "httpStatusCode": number;
    /**
     * Additional context about the failure
     */
    "detail"?: string | null;
    constructor(payload: any);
}
/**
 * Structured query definition that specifies what data to retrieve and how to filter, group, and order it
 */
export declare class QueryDefinition {
    /**
     * Array of measures to retrieve, representing quantitative values or metrics to be calculated
     */
    "measures"?: Array<string>;
    /**
     * Array of dimensions to retrieve, representing categorical attributes for grouping and organizing data
     */
    "dimensions"?: Array<string>;
    /**
     * Nested filter conditions. Always use `op` and `expressions`.
     */
    "filters"?: Array<QueryDefinitionFilters>;
    /**
     * Specifications for sorting the query results by specific fields in ascending or descending order
     */
    "orderBy"?: Array<QueryDefinitionOrderBy>;
    constructor(payload: any);
}
export declare class QueryDefinitionFilters {
    "op"?: string;
    "expressions": Array<QueryDefinitionFiltersExpressions>;
    constructor(payload: any);
}
export declare class QueryDefinitionFiltersExpressions {
    "op": string;
    "field": string;
    "values"?: Array<string>;
    constructor(payload: any);
}
export declare class QueryDefinitionOrderBy {
    /**
     * Dimension or measure to order by
     */
    "field"?: string;
    /**
     * Sort order direction, ascending or descending
     */
    "direction"?: string;
    constructor(payload: any);
}
/**
 * Options to pass to create a QueryJobInstance
 */
export interface QueryJobListInstanceCreateOptions {
    /**  */
    insightsQueryRequest: InsightsQueryRequest;
    /** Client-generated UUIDv7 key to ensure idempotent behavior. Submitting the same key for identical requests returns the same operation without re-execution. Scoped to Account + Region. Retained for 24 hours.  */
    idempotencyKey?: string;
}
/**
 * Options to pass to each
 */
export interface QueryJobListInstanceEachOptions {
    /** The maximum number of resources to return */
    pageSize?: number;
    /** Token for pagination */
    pageToken?: string;
    /** Filter by operation status. */
    status?: LongRunningOperationStatus;
    /** Function to process each record. If this and a positional callback are passed, this one will be used */
    callback?: (item: QueryJobInstance, done: (err?: Error) => void) => void;
    /** Function to be called upon completion of streaming */
    done?: Function;
    /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
    limit?: number;
}
/**
 * Options to pass to list
 */
export interface QueryJobListInstanceOptions {
    /** The maximum number of resources to return */
    pageSize?: number;
    /** Token for pagination */
    pageToken?: string;
    /** Filter by operation status. */
    status?: LongRunningOperationStatus;
    /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
    limit?: number;
}
/**
 * Options to pass to page
 */
export interface QueryJobListInstancePageOptions {
    /** The maximum number of resources to return */
    pageSize?: number;
    /** Token for pagination */
    pageToken?: string;
    /** Filter by operation status. */
    status?: LongRunningOperationStatus;
}
export interface QueryJobContext {
    /**
     * Fetch a QueryJobInstance
     *
     * @param callback - Callback to handle processed record
     *
     * @returns Resolves to processed QueryJobInstance
     */
    fetch(callback?: (error: Error | null, item?: QueryJobInstance) => any): Promise<QueryJobInstance>;
    /**
     * Fetch a QueryJobInstance and return HTTP info
     *
     * @param callback - Callback to handle processed record
     *
     * @returns Resolves to processed QueryJobInstance with HTTP metadata
     */
    fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<QueryJobInstance>) => any): Promise<ApiResponse<QueryJobInstance>>;
    /**
     * Provide a user-friendly representation
     */
    toJSON(): any;
    [inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface QueryJobContextSolution {
    operationId: string;
}
export declare class QueryJobContextImpl implements QueryJobContext {
    protected _version: V3;
    protected _solution: QueryJobContextSolution;
    protected _uri: string;
    constructor(_version: V3, operationId: string);
    fetch(callback?: (error: Error | null, item?: QueryJobInstance) => any): Promise<QueryJobInstance>;
    fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<QueryJobInstance>) => any): Promise<ApiResponse<QueryJobInstance>>;
    /**
     * Provide a user-friendly representation
     *
     * @returns Object
     */
    toJSON(): QueryJobContextSolution;
    [inspect.custom](_depth: any, options: InspectOptions): string;
}
/**
 * Nested model for InsightsQueryRequest
 */
export interface InsightsQueryRequest {
    domain?: string;
    query: QueryDefinition;
}
/**
 * Nested model for OperationError
 */
export interface OperationError {
    code: number;
    message: string;
    httpStatusCode: number;
    detail?: string | null;
}
/**
 * Nested model for QueryDefinition
 */
export interface QueryDefinition {
    measures?: Array<string>;
    dimensions?: Array<string>;
    filters?: Array<QueryDefinitionFilters>;
    orderBy?: Array<QueryDefinitionOrderBy>;
}
/**
 * Nested model for QueryDefinitionFilters
 */
export interface QueryDefinitionFilters {
    op?: string;
    expressions: Array<QueryDefinitionFiltersExpressions>;
}
/**
 * Nested model for QueryDefinitionFiltersExpressions
 */
export interface QueryDefinitionFiltersExpressions {
    op: string;
    field: string;
    values?: Array<string>;
}
/**
 * Nested model for QueryDefinitionOrderBy
 */
export interface QueryDefinitionOrderBy {
    field?: string;
    direction?: string;
}
interface QueryJobPayload extends TokenPaginationPayload {
    items: QueryJobResource[];
}
/**
 * Response model for QueryJobSubmitResponse operations
 */
interface QueryJobSubmitResponse_ResponseResource {
    operationId: string;
    status: LongRunningOperationStatus;
    statusUrl: string;
    createdAt: Date;
}
/**
 * Response model for QueryJobStatusResponse operations
 */
interface QueryJobStatusResponse_ResponseResource {
    operationId: string;
    status: LongRunningOperationStatus;
    statusUrl?: string;
    createdAt: Date;
    completedAt?: Date;
    error?: OperationError;
    resultUrl?: string;
    resultRetentionPeriod?: string;
}
/**
 * Union type for all possible response models
 */
type QueryJobResource = QueryJobSubmitResponse_ResponseResource | QueryJobStatusResponse_ResponseResource;
/**
 * Initial 202 response for an async query submission. Conforms to LongRunningOperation202Response from Twilio API Standards.
 */
export declare class QueryJobInstance {
    protected _version: V3;
    protected _solution: QueryJobContextSolution;
    protected _context?: QueryJobContext;
    constructor(_version: V3, _payload: QueryJobResource, operationId?: string);
    /**
     * Unique identifier for the async query operation.
     */
    operationId?: string;
    status?: LongRunningOperationStatus;
    /**
     * URI to poll for operation status.
     */
    statusUrl?: string;
    /**
     * When the operation was accepted (RFC 3339 UTC).
     */
    createdAt?: Date;
    /**
     * When the operation reached a terminal state.
     */
    completedAt?: Date;
    /**
     * Error details. Present only when status is FAILED.
     */
    error?: OperationError;
    /**
     * URL to retrieve query results. Present only when status is COMPLETED. Supports pagination via pageSize and pageToken query parameters.
     */
    resultUrl?: string;
    /**
     * ISO 8601 duration for how long results are retained.
     */
    resultRetentionPeriod?: string;
    private get _proxy();
    /**
     * Fetch a QueryJobInstance
     *
     * @param callback - Callback to handle processed record
     *
     * @returns Resolves to processed QueryJobInstance
     */
    fetch(callback?: (error: Error | null, item?: QueryJobInstance) => any): Promise<QueryJobInstance>;
    /**
     * Fetch a QueryJobInstance and return HTTP info
     *
     * @param callback - Callback to handle processed record
     *
     * @returns Resolves to processed QueryJobInstance with HTTP metadata
     */
    fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<QueryJobInstance>) => any): Promise<ApiResponse<QueryJobInstance>>;
    /**
     * Provide a user-friendly representation
     *
     * @returns Object
     */
    toJSON(): {
        operationId: string;
        status: LongRunningOperationStatus;
        statusUrl: string;
        createdAt: Date;
        completedAt: Date;
        error: OperationError;
        resultUrl: string;
        resultRetentionPeriod: string;
    };
    [inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface QueryJobSolution {
}
export interface QueryJobListInstance {
    _version: V3;
    _solution: QueryJobSolution;
    _uri: string;
    (operationId: string): QueryJobContext;
    get(operationId: string): QueryJobContext;
    /**
     * Create a QueryJobInstance
     *
     * @param params - Body for request
     * @param headers - header params for request
     * @param callback - Callback to handle processed record
     *
     * @returns Resolves to processed QueryJobInstance
     */
    create(params: InsightsQueryRequest, headers?: any, callback?: (error: Error | null, item?: QueryJobInstance) => any): Promise<QueryJobInstance>;
    /**
     * Create a QueryJobInstance and return HTTP info
     *
     * @param params - Body for request
     * @param headers - header params for request
     * @param callback - Callback to handle processed record
     *
     * @returns Resolves to processed QueryJobInstance with HTTP metadata
     */
    createWithHttpInfo(params: InsightsQueryRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<QueryJobInstance>) => any): Promise<ApiResponse<QueryJobInstance>>;
    /**
     * Streams QueryJobInstance records from the API.
     *
     * This operation lazily loads records as efficiently as possible until the limit
     * is reached.
     *
     * The results are passed into the callback function, so this operation is memory
     * efficient.
     *
     * If a function is passed as the first argument, it will be used as the callback
     * function.
     *
     * @param { QueryJobListInstanceEachOptions } [params] - Options for request
     * @param { function } [callback] - Function to process each record
     */
    each(callback?: (item: QueryJobInstance, done: (err?: Error) => void) => void): void;
    each(params: QueryJobListInstanceEachOptions, callback?: (item: QueryJobInstance, done: (err?: Error) => void) => void): void;
    /**
     * Streams QueryJobInstance records from the API with HTTP metadata captured per page.
     *
     * This operation lazily loads records as efficiently as possible until the limit
     * is reached. HTTP metadata (status code, headers) is captured for each page request.
     *
     * The results are passed into the callback function, so this operation is memory
     * efficient.
     *
     * If a function is passed as the first argument, it will be used as the callback
     * function.
     *
     * @param { QueryJobListInstanceEachOptions } [params] - Options for request
     * @param { function } [callback] - Function to process each record
     */
    eachWithHttpInfo(callback?: (item: QueryJobInstance, done: (err?: Error) => void) => void): void;
    eachWithHttpInfo(params: QueryJobListInstanceEachOptions, callback?: (item: QueryJobInstance, done: (err?: Error) => void) => void): void;
    /**
     * Retrieve a single target page of QueryJobInstance records from the API.
     *
     * The request is executed immediately.
     *
     * @param { string } [targetUrl] - API-generated URL for the requested results page
     * @param { function } [callback] - Callback to handle list of records
     */
    getPage(targetUrl: string, callback?: (error: Error | null, items: QueryJobPage) => any): Promise<QueryJobPage>;
    /**
     * Retrieve a single target page of QueryJobInstance records from the API with HTTP metadata.
     *
     * The request is executed immediately.
     *
     * @param { string } [targetUrl] - API-generated URL for the requested results page
     * @param { function } [callback] - Callback to handle list of records with metadata
     */
    getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<QueryJobPage>) => any): Promise<ApiResponse<QueryJobPage>>;
    /**
     * Lists QueryJobInstance records from the API as a list.
     *
     * If a function is passed as the first argument, it will be used as the callback
     * function.
     *
     * @param { QueryJobListInstanceOptions } [params] - Options for request
     * @param { function } [callback] - Callback to handle list of records
     */
    list(callback?: (error: Error | null, items: QueryJobInstance[]) => any): Promise<QueryJobInstance[]>;
    list(params: QueryJobListInstanceOptions, callback?: (error: Error | null, items: QueryJobInstance[]) => any): Promise<QueryJobInstance[]>;
    /**
     * Lists QueryJobInstance records from the API as a list with HTTP metadata.
     *
     * Returns all records along with HTTP metadata from the first page fetched.
     *
     * If a function is passed as the first argument, it will be used as the callback
     * function.
     *
     * @param { QueryJobListInstanceOptions } [params] - Options for request
     * @param { function } [callback] - Callback to handle list of records with metadata
     */
    listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<QueryJobInstance[]>) => any): Promise<ApiResponse<QueryJobInstance[]>>;
    listWithHttpInfo(params: QueryJobListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<QueryJobInstance[]>) => any): Promise<ApiResponse<QueryJobInstance[]>>;
    /**
     * Retrieve a single page of QueryJobInstance records from the API.
     *
     * The request is executed immediately.
     *
     * If a function is passed as the first argument, it will be used as the callback
     * function.
     *
     * @param { QueryJobListInstancePageOptions } [params] - Options for request
     * @param { function } [callback] - Callback to handle list of records
     */
    page(callback?: (error: Error | null, items: QueryJobPage) => any): Promise<QueryJobPage>;
    page(params: QueryJobListInstancePageOptions, callback?: (error: Error | null, items: QueryJobPage) => any): Promise<QueryJobPage>;
    /**
     * Retrieve a single page of QueryJobInstance records from the API with HTTP metadata.
     *
     * The request is executed immediately.
     *
     * If a function is passed as the first argument, it will be used as the callback
     * function.
     *
     * @param { QueryJobListInstancePageOptions } [params] - Options for request
     * @param { function } [callback] - Callback to handle list of records with metadata
     */
    pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<QueryJobPage>) => any): Promise<ApiResponse<QueryJobPage>>;
    pageWithHttpInfo(params: QueryJobListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<QueryJobPage>) => any): Promise<ApiResponse<QueryJobPage>>;
    /**
     * Provide a user-friendly representation
     */
    toJSON(): any;
    [inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function QueryJobListInstance(version: V3): QueryJobListInstance;
export declare class QueryJobPage extends TokenPage<V3, QueryJobPayload, QueryJobResource, QueryJobInstance> {
    /**
     * Initialize the QueryJobPage
     *
     * @param version - Version of the resource
     * @param response - Response from the API
     * @param uri - URI of the resource
     * @param params - Query parameters
     * @param solution - Path solution
     */
    constructor(version: V3, response: Response<string>, uri: string, params: any, solution: QueryJobSolution);
    /**
     * Build an instance of QueryJobInstance
     *
     * @param payload - Payload response from the API
     */
    getInstance(payload: QueryJobResource): QueryJobInstance;
    [inspect.custom](depth: any, options: InspectOptions): string;
}
export {};
