package org.bench4q.web.validation;

import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

@Component
public class PluginValidate {

	public ValidateResponseModel validatePluginName(String pluginName) {
		if (ValidateHelper.validateStringInput(pluginName)) {
			return new ValidateResponseModel(true, "");

		} else {
			return new ValidateResponseModel(false, "error pluginName");
		}

	}

	public ValidateResponseModel validatePluginUIFile(MultipartFile pluginUIFile) {
		if (pluginUIFile == null) {
			return new ValidateResponseModel(false, "no file");
		}
		if (pluginUIFile.isEmpty()) {
			return new ValidateResponseModel(false, "empty file");
		}
		return new ValidateResponseModel(true, "");

	}
}