import { IServerError, ServerError } from "../../domain/errors";

export interface IApplicationServiceError extends IServerError {}

export class ApplicationServiceError
  extends ServerError
  implements IApplicationServiceError
{
  public static readonly INVALID_REQUEST_PARAM = "INVALID_REQUEST_PARAM";
  public static readonly INVALID_INPUT_DATA = "INVALID_INPUT_DATA";
  public static readonly UNEXCEPTED_ERROR = "UNEXCEPTED_ERROR";
  public static readonly REPOSITORY_ERROR = "REPOSITORY_ERROR";
  public static readonly NOT_FOUND_ERROR = "NOT_FOUND_ERROR";
  public static readonly RESOURCE_ALREADY_EXITS = "RESOURCE_ALREADY_EXITS";

  public static create(
    code: string,
    message: string,
    details?: Record<string, any>
  ): ApplicationServiceError {
    return new ApplicationServiceError(code, message, details);
  }
}
