package validator

// 定义自定义错误消息
var customMessages = map[string]string{
	"Name.min":             "姓名不能少于1个字",
	"Name.required":        "姓名是必填项",
	"Name.name":            "姓名只能包含中文",
	"NameMan.min":          "男方姓名不能少于1个字",
	"NameMan.required":     "男方姓名是必填项",
	"NameMan.name":         "男方姓名只能包含中文",
	"NameWoman.min":        "女方姓名不能少于1个字",
	"NameWoman.required":   "女方姓名是必填项",
	"NameWoman.name":       "女方姓名只能包含中文",
	"Mobile.required":      "手机号是必填项",
	"Mobile.min":           "电话号码必须为有效的中国电话号码",
	"Mobile.max":           "电话号码必须为有效的中国电话号码",
	"Mobile.mobile":        "电话号码必须为有效的中国电话号码",
	"IDCard.required":      "身份证号是必填项",
	"IDCard.idCard":        "无效的身份证号码",
	"IDCardMan.required":   "男方身份证号是必填项",
	"IDCardMan.idCard":     "无效的男方身份证号码",
	"IDCardWoman.required": "女方身份证号是必填项",
	"IDCardWoman.idCard":   "无效的女方身份证号码",
	"Password.min":         "密码不能少于8位数",
	"Password.max":         "密码不能超过32位数",
	"Password.password":    "密码强度太弱",
	//"EntCode.required":"请输入统一社会信用代码",
	//"EntCode.USCI": "请输入正确的统一社会信用代码",
}

// 获取自定义错误消息
func GetErrorMessage(field, tag string) string {
	key := field + "." + tag
	if msg, exists := customMessages[key]; exists {
		return msg
	}
	return "请输入正确格式的参数"
}
