package enum

var (
	notAccountCheck = NewEnum(0, "不需要校验账户状态")   //0 -> 00000000
	needUserAccount = NewEnum(1, "需要用户账户状态")    //1 -> 00000001
	needEntAccount  = NewEnum(1<<1, "需要企业账户状态") //2 -> 00000010
)

type AccountCheck struct {
	*Enum
}

// NewAccountCheck 初始化账户状态校验对象
func NewAccountCheck(code int64, desc ...string) *AccountCheck {
	return &AccountCheck{
		NewEnum(code, desc...),
	}
}

// NeedCheck 是否需要进行账户状态校验
func (ac *AccountCheck) NeedCheck() bool {
	return ac.GetCode() != notAccountCheck.code
}

// CheckUserAccount 校验是否需要用户Status
func (ac *AccountCheck) CheckUserAccount() bool {
	return needUserAccount.code == (ac.GetCode() & needUserAccount.code)
}

// CheckEntAccount 校验是否需要企业Status
func (ac *AccountCheck) CheckEntAccount() bool {
	return needEntAccount.code == (ac.GetCode() & needEntAccount.code)
}
