package utils

import (
	"net/http"

	"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/errors"
)

var clientErrors = map[int]error{
	http.StatusInternalServerError: errors.ErrInternalError,
	http.StatusBadRequest:          errors.ErrInvalidArgs,
	http.StatusNotImplemented:      errors.ErrMethodNotImplemented,
	http.StatusNotFound:            errors.ErrNotFound,
	http.StatusForbidden:           errors.ErrNoAccess,
}

func DetermineClientErrorResponse(statusCode int) error {
	err, ok := clientErrors[statusCode]
	if !ok {
		return errors.ErrInternalError
	}

	return err
}
