package utils

import (
	"regexp"
)

var (
	patternEmail string         = "^([.]?[a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+"
	patternPhone string         = "^(13[0-9]|14[57]|15[0-35-9]|18[0-9]|17[0-9]|16[7]|19[1])\\d{8}$"
	expEmail     *regexp.Regexp = regexp.MustCompile(patternEmail)
	expPhone     *regexp.Regexp = regexp.MustCompile(patternPhone)
)

func IsEmail(email string) bool {
	return expEmail.MatchString(email)
}

func IsPhone(phone string) bool {
	return expPhone.MatchString(phone)
}

func IsPhoneSimple(phone string) bool {
	if len(phone) != 11 {
		return false
	}
	return phone[0] == 49
}

func IsAlpha(alpha string) bool {
	return false
}

func IsSafePasswd(passwd string) bool {
	return false
}
