package render

var (
	OK            = NewCode(0, "成功")
	Failed        = NewCode(1, "失败")
	ParamError    = NewCode(1001, "参数错误")
	NameEmpty     = NewCode(1002, "名称不能为空")
	NameDuplicate = NewCode(1003, "名称或编号不能重复")
	ListEmpty     = NewCode(1004, "列表不能为空")
	RepeatCommit  = NewCode(1005, "请勿重复提交")
)

type Code struct {
	code    int
	message string
}

func NewCode(code int, message string) *Code {
	return &Code{
		code:    code,
		message: message,
	}
}

func (c *Code) Code() int {
	return c.code
}

func (c *Code) Message() string {
	return c.message
}
