import { HttpStatusCodes } from "../httpStatusCodes.js";
import { ResponseData } from "../responseData.js";
import { ErrorCodes } from "./errorCodes.js";
import { AppError } from "./ErrorsClass.js";
import { StrictModeLocaleMap } from "@intlayer/types";
import { FastifyReply } from "fastify";
import { Response } from "express";

//#region src/utils/errors/ErrorHandler.d.ts
type ResponseLike = Response | FastifyReply;
declare class ErrorHandler {
  /**
   * Handles generic error responses by formatting and sending a JSON response.
   * @param res - The response object provided by Express.js.
   * @param errorKey - A key representing the specific error.
   * @param statusCode - (Optional) A specific HTTP status code to use for the response.
   * @param isPaginatedResponse - Flag to determine if the response should be paginated.
   */
  static handleGenericErrorResponse(res: ResponseLike, errorKey: ErrorCodes, errorDetails?: object, statusCode?: HttpStatusCodes, isPaginatedResponse?: boolean): void;
  /**
   * Handles application-specific error responses by formatting and sending a JSON response.
   * @param res - The response object provided by Express.js.
   * @param error - The error object.
   * @param messageDetails - (Optional) Additional message details to include in the response.
   * @param isPaginatedResponse - (Optional) Flag to determine if the response should be paginated.
   */
  static handleAppErrorResponse(res: ResponseLike, error: AppError, messageDetails?: object, isPaginatedResponse?: boolean): void;
  /**
   * Handles more customizable error responses with detailed error messages and codes.
   * @param res - The response object.
   * @param errorKey - Error code key used to fetch the corresponding message and default status.
   * @param message - The localized error message object.
   * @param messageDetails - (Optional) Additional message details to include in the response.
   * @param statusCode - (Optional) HTTP status code, defaults to 500 if not specified.
   * @param isPaginatedResponse - Determines if the error should be part of a paginated response.
   */
  static handleCustomErrorResponse<T>(res: ResponseLike, errorKey: ErrorCodes | string, title: StrictModeLocaleMap<string> | string, message: StrictModeLocaleMap<string> | string, messageDetails?: object, statusCode?: HttpStatusCodes, isPaginatedResponse?: boolean): void;
  /**
   * Formats a generic error response without sending it (useful for Fastify plugins).
   * @param errorKey - A key representing the specific error.
   * @param errorDetails - Optional error details to include.
   * @param statusCode - Optional HTTP status code.
   * @returns Formatted error response object.
   */
  static formatGenericErrorResponse(errorKey: ErrorCodes, errorDetails?: object, statusCode?: HttpStatusCodes): ResponseData<{
    name: string;
    id: string;
    createdAt: Date;
    updatedAt: Date;
    email: string;
    image?: string;
    emailVerified: boolean;
    phone?: string;
    dateOfBirth?: Date;
    role?: string;
    emailsList?: {
      newsLetter: boolean;
    };
    customerId?: string;
    lastLoginMethod?: "email" | "google" | "github" | "passkey";
    lang?: string;
  }>;
}
//#endregion
export { ErrorHandler };
//# sourceMappingURL=ErrorHandler.d.ts.map