package app_error

import "net/http"

// Helpers for creating common errors

// NewValidationError creates a validation error.
func NewValidationError(message string) *AppError {
	return New(ValidationError, message, http.StatusBadRequest)
}

// NewNotFoundError creates a not found error.
func NewNotFoundError(message string) *AppError {
	return New(NotFoundError, message, http.StatusNotFound)
}

// NewUnauthorizedError creates an unauthorized error.
func NewUnauthorizedError(message string) *AppError {
	return New(UnauthorizedError, message, http.StatusUnauthorized)
}

// NewInternalError creates an internal server error.
func NewInternalError(err error) *AppError {
	return Wrap(err, InternalError, "An internal server error occurred", http.StatusInternalServerError)
}

// NewAuthError creates an authentication error.
func NewAuthError(message string) *AppError {
	return New(AuthError, message, http.StatusUnauthorized)
}
