import { Detail, Details } from './detail.cjs';
import './reason.cjs';

declare const Code: {
    readonly OK: 200;
    readonly CANCELLED: 499;
    readonly UNKNOWN: 500;
    readonly INVALID_ARGUMENT: 400;
    readonly DEADLINE_EXCEEDED: 504;
    readonly NOT_FOUND: 404;
    readonly ALREADY_EXISTS: 409;
    readonly PERMISSION_DENIED: 403;
    readonly RESOURCE_EXHAUSTED: 429;
    readonly FAILED_PRECONDITION: 400;
    readonly ABORTED: 409;
    readonly OUT_OF_RANGE: 400;
    readonly UNIMPLEMENTED: 501;
    readonly INTERNAL: 500;
    readonly UNAVAILABLE: 503;
    readonly DATA_LOSS: 500;
    readonly UNAUTHENTICATED: 401;
    readonly METHOD_NOT_ALLOWED: 405;
};
declare const DEFAULT_MESSAGES: Record<keyof typeof Code, string>;
interface ErrorBody {
    error: {
        code: number;
        status: keyof typeof Code;
        message: string;
        details: Detail[];
    };
}
declare class StatusError extends Error {
    readonly status: number;
    readonly body?: ErrorBody;
    constructor(status: number, body?: ErrorBody);
}
declare class StatusCode {
    code: keyof typeof Code;
    message?: string;
    private constructor();
    static of(code: keyof typeof Code, message?: string): StatusCode;
    body(details?: Details): ErrorBody;
    error(details?: Details): Error;
    response(details?: Details): Response;
}
declare class Status {
    static adapter?: (status: number, response: ErrorBody) => Error;
    static ok: (message?: string) => StatusCode;
    static cancelled: (message?: string) => StatusCode;
    static unknown: (message?: string) => StatusCode;
    static invalidArgument: (message?: string) => StatusCode;
    static deadlineExceeded: (message?: string) => StatusCode;
    static notFound: (message?: string) => StatusCode;
    static alreadyExists: (message?: string) => StatusCode;
    static permissionDenied: (message?: string) => StatusCode;
    static unauthorized: (message?: string) => StatusCode;
    static resourceExhausted: (message?: string) => StatusCode;
    static failedPrecondition: (message?: string) => StatusCode;
    static aborted: (message?: string) => StatusCode;
    static outOfRange: (message?: string) => StatusCode;
    static unimplemented: (message?: string) => StatusCode;
    static internal: (message?: string) => StatusCode;
    static unavailable: (message?: string) => StatusCode;
    static dataLoss: (message?: string) => StatusCode;
    static methodNotAllowed: (message?: string) => StatusCode;
}

export { Code, DEFAULT_MESSAGES, type ErrorBody, Status, StatusCode, StatusError };
