package org.bench4q.web.validation;

import org.springframework.stereotype.Component;

@Component
public class UserValidate {

	public ValidateResponseModel validateRegisterUser(String userName,
			String password, String scope) {

		if (!ValidateHelper.validateStringInput(userName)) {
			return new ValidateResponseModel(false, "error user name");
		}
		if (!ValidateHelper.validateStringInput(password)) {
			return new ValidateResponseModel(false, "error password");
		}
		if (!ValidateHelper.validateInteger(scope)) {
			return new ValidateResponseModel(false, "error scope");
		}
		return new ValidateResponseModel(true, "");
	}
	public ValidateResponseModel validateUserLogin(String userName,String password){
		if (!ValidateHelper.validateStringInput(userName)) {
			return new ValidateResponseModel(false, "error user name");
		}
		if (!ValidateHelper.validateStringInput(password)) {
			return new ValidateResponseModel(false, "error password");
		}
		return new ValidateResponseModel(true, "");
	}
}