import { ResolvedErrorReason } from './reason.cjs';

/** reference: https://github.com/googleapis/googleapis/blob/master/google/rpc/error_details.proto */

declare enum DetailType {
    ERROR_INFO = "type.googleapis.com/google.rpc.ErrorInfo",
    RETRY_INFO = "type.googleapis.com/google.rpc.RetryInfo",
    DEBUG_INFO = "type.googleapis.com/google.rpc.DebugInfo",
    QUOTA_FAILURE = "type.googleapis.com/google.rpc.QuotaFailure",
    PRECONDITION_FAILURE = "type.googleapis.com/google.rpc.PreconditionFailure",
    BAD_REQUEST = "type.googleapis.com/google.rpc.BadRequest",
    REQUEST_INFO = "type.googleapis.com/google.rpc.RequestInfo",
    RESOURCE_INFO = "type.googleapis.com/google.rpc.ResourceInfo",
    HELP = "type.googleapis.com/google.rpc.Help",
    LOCALIZED_MESSAGE = "type.googleapis.com/google.rpc.LocalizedMessage"
}
interface ErrorInfo {
    '@type': DetailType.ERROR_INFO;
    reason: ResolvedErrorReason;
    domain?: string;
    metadata?: Record<string, string>;
}
interface RetryInfo {
    '@type': DetailType.RETRY_INFO;
    retryDelay: number;
}
interface DebugInfo {
    '@type': DetailType.DEBUG_INFO;
    stackEntries: string[];
    detail: string;
}
interface QuotaFailure {
    '@type': DetailType.QUOTA_FAILURE;
    violations: {
        subject: string;
        description: string;
        apiService: string;
        quoteId: string;
        quoteValue: number;
        quotaMetric: string;
        quotaDimensions: Record<string, string>;
        futureQuotaValue: number;
    }[];
}
interface PreconditionFailure {
    '@type': DetailType.PRECONDITION_FAILURE;
    violations: {
        type: string;
        subject: string;
        description: string;
    }[];
}
interface BadRequest {
    '@type': DetailType.BAD_REQUEST;
    fieldViolations: {
        field: string;
        description: string;
        reason: string;
        localizedMessage: Omit<LocalizedMessage, '@type'>;
    }[];
}
interface RequestInfo {
    '@type': DetailType.REQUEST_INFO;
    requestId: string;
    servingData: string;
}
interface ResourceInfo {
    '@type': DetailType.RESOURCE_INFO;
    resourceType: string;
    resourceName: string;
    owner: string;
    description: string;
}
interface Help {
    '@type': DetailType.HELP;
    links: {
        url: string;
        description: string;
    }[];
}
interface LocalizedMessage {
    '@type': DetailType.LOCALIZED_MESSAGE;
    locale: string;
    message: string;
}
type Detail = RetryInfo | DebugInfo | QuotaFailure | ErrorInfo | PreconditionFailure | BadRequest | RequestInfo | ResourceInfo | Help | LocalizedMessage;
/**
 * Example usage:
 * const details = Details.new()
 *   .requestInfo({ requestId: '1234567890', servingData: '/v1/tests' })
 *   .errorInfo({ reason: 'ACCOUNT_LOCKED' });
 * */
declare class Details {
    readonly list: Detail[];
    private constructor();
    static new(): Details;
    errorInfo(detail: Omit<ErrorInfo, '@type'>): this;
    retryInfo(detail: Omit<RetryInfo, '@type'>): this;
    debugInfo(detail: Omit<DebugInfo, '@type'>): this;
    quotaFailure(detail: Omit<QuotaFailure, '@type'>): this;
    preconditionFailure(detail: Omit<PreconditionFailure, '@type'>): this;
    badRequest(detail: Omit<BadRequest, '@type'>): this;
    requestInfo(detail: Omit<RequestInfo, '@type'>): this;
    resourceInfo(detail: Omit<ResourceInfo, '@type'>): this;
    help(detail: Omit<Help, '@type'>): this;
    localizedMessage(detail: Omit<LocalizedMessage, '@type'>): this;
}

export { type BadRequest, type DebugInfo, type Detail, DetailType, Details, type ErrorInfo, type Help, type LocalizedMessage, type PreconditionFailure, type QuotaFailure, type RequestInfo, type ResourceInfo, type RetryInfo };
