package config

import (
	"errors"
	"net/http"
)

var (
	ErrInvalidNKodeLength          = errors.New("invalid nKode length")
	ErrInvalidNKodeIdx             = errors.New("invalid passcode attribute index")
	ErrTooFewDistinctSet           = errors.New("too few distinct sets")
	ErrTooFewDistinctAttributes    = errors.New("too few distinct attributes")
	ErrEmailAlreadySent            = errors.New("email already sent")
	ErrClaimExpOrNil               = errors.New("claim expired or nil")
	ErrInvalidJwt                  = errors.New("invalid jwt")
	ErrInvalidKeypadDimensions     = errors.New("keypad dimensions out of range")
	ErrUserAlreadyExists           = errors.New("user already exists")
	ErrSignupSessionDNE            = errors.New("signup session does not exist")
	ErrUserForCustomerDNE          = errors.New("user does not exist")
	ErrRefreshTokenInvalid         = errors.New("refresh token invalid")
	ErrCustomerDne                 = errors.New("customer does not exist")
	ErrSvgDne                      = errors.New("svg ")
	ErrStoppingDatabase            = errors.New("stopping database")
	ErrSqliteTx                    = errors.New("sqlite begin, exec, query, or commit error. see logs")
	ErrEmptySvgTable               = errors.New("empty svg_icon table")
	ErrKeyIndexOutOfRange          = errors.New("one or more keys is out of range")
	ErrAttributeIndexOutOfRange    = errors.New("attribute index out of range")
	ErrInternalValidKeyEntry       = errors.New("internal validation error")
	ErrUserMaskTooLong             = errors.New("user mask length exceeds max nkode length")
	ErrInterfaceNotDispersible     = errors.New("interface is not dispersible")
	ErrIncompleteUserSignupSession = errors.New("incomplete user signup session")
	ErrSetConfirmSignupMismatch    = errors.New("set and confirm nkode are not the same")
	ErrKeypadIsNotDispersible      = errors.New("keypad is not dispersible")
	ErrInvalidNKode                = errors.New("invalid nKode")
	ErrStringIsNotAnSVG            = errors.New("string is not an svg")
)

var HttpErrMap = map[error]int{
	ErrInvalidNKodeLength:          http.StatusBadRequest,
	ErrInvalidNKodeIdx:             http.StatusBadRequest,
	ErrTooFewDistinctSet:           http.StatusBadRequest,
	ErrTooFewDistinctAttributes:    http.StatusBadRequest,
	ErrEmailAlreadySent:            http.StatusBadRequest,
	ErrClaimExpOrNil:               http.StatusForbidden,
	ErrInvalidJwt:                  http.StatusForbidden,
	ErrInvalidKeypadDimensions:     http.StatusBadRequest,
	ErrUserAlreadyExists:           http.StatusBadRequest,
	ErrSignupSessionDNE:            http.StatusBadRequest,
	ErrUserForCustomerDNE:          http.StatusBadRequest,
	ErrRefreshTokenInvalid:         http.StatusForbidden,
	ErrCustomerDne:                 http.StatusBadRequest,
	ErrSvgDne:                      http.StatusBadRequest,
	ErrStoppingDatabase:            http.StatusInternalServerError,
	ErrSqliteTx:                    http.StatusInternalServerError,
	ErrEmptySvgTable:               http.StatusInternalServerError,
	ErrKeyIndexOutOfRange:          http.StatusBadRequest,
	ErrAttributeIndexOutOfRange:    http.StatusInternalServerError,
	ErrInternalValidKeyEntry:       http.StatusInternalServerError,
	ErrUserMaskTooLong:             http.StatusInternalServerError,
	ErrInterfaceNotDispersible:     http.StatusInternalServerError,
	ErrIncompleteUserSignupSession: http.StatusBadRequest,
	ErrSetConfirmSignupMismatch:    http.StatusBadRequest,
	ErrKeypadIsNotDispersible:      http.StatusInternalServerError,
	ErrInvalidNKode:                http.StatusBadRequest,
	ErrStringIsNotAnSVG:            http.StatusInternalServerError,
}
