package zapx

import (
	"net/http"

	"github.com/go-kratos/kratos/v2/errors"
)

const (
	ReasonValidate       = "VALIDATE"        // 参数校验错误
	ReasonInvalidUser    = "INVALID_USER"    // 用户名或密码错误
	ReasonInternalServer = "INTERNAL_SERVER" // 内部服务错误
	ReasonNoCategory     = "NO_CATEGORY"     // 没有分类错误
	ReasonInvalidToken   = "INVALID_TOKEN"   // 无效令牌错误
)

// ValidateError 创建参数校验错误
func ValidateError(msg string) error {
	return errors.New(http.StatusBadRequest, ReasonValidate, msg)
}

// InvalidUserError 创建用户错误
func InvalidUserError(msg string) error {
	return errors.New(http.StatusBadRequest, ReasonInvalidUser, msg)
}

// InternalServerError 创建内部错误
func InternalServerError(msg string) error {
	return errors.New(http.StatusInternalServerError, ReasonInternalServer, msg)
}

// NoCategoryError 创建无系统分类错误
func NoCategoryError(msg string) error {
	return errors.New(http.StatusBadRequest, ReasonNoCategory, msg)
}

// InvalidTokenError 创建无效令牌错误
func InvalidTokenError(msg string) error {
	return errors.New(http.StatusUnauthorized, ReasonInvalidToken, msg)
}
