package org.bench4q.web.validation;

import org.springframework.stereotype.Component;

@Component
public class AgentValidate {

	public ValidateResponseModel validateAddedAgent(String hostName,
			String maxLoad, String port) {
		if (!ValidateHelper.validateIp(hostName)) {
			return new ValidateResponseModel(false, "error host name");
		}
		if (!ValidateHelper.validateInteger(maxLoad)) {
			return new ValidateResponseModel(false, "error maxLoad");
		}
		if (!ValidateHelper.validateInteger(port)) {
			return new ValidateResponseModel(false, "error port");

		}
		return new ValidateResponseModel(true, "");
	}

	public ValidateResponseModel validateDeleteAgent(String hostName,
			String agentId) {
		if (!ValidateHelper.validateIp(hostName)) {
			return new ValidateResponseModel(false, "error host name");
		}
		if (!ValidateHelper.validateInteger(agentId)) {
			return new ValidateResponseModel(false, "error agentId");
		}
		return new ValidateResponseModel(true, "");
	}

}
