package identity

import "fmt"

type HTTPError struct {
	Status int
	Detail any
}

func (e HTTPError) Error() string {
	return fmt.Sprint(e.Detail)
}

func BadRequest(detail any) HTTPError {
	return HTTPError{Status: 400, Detail: detail}
}

func Unauthorized(detail any) HTTPError {
	return HTTPError{Status: 401, Detail: detail}
}

func Forbidden(detail any) HTTPError {
	return HTTPError{Status: 403, Detail: detail}
}

func TooManyRequests(detail any) HTTPError {
	return HTTPError{Status: 429, Detail: detail}
}

func ServiceUnavailable(detail any) HTTPError {
	return HTTPError{Status: 503, Detail: detail}
}
