package org.takiguchi.cerberus.cerberusapp.service.validator;

import org.springframework.stereotype.Component;
import org.takiguchi.cerberus.cerberusapp.model.Application;
import org.takiguchi.cerberus.cerberusapp.service.exception.ValidationException;

@Component
public class ApplicationValidator {

    public void validate(Application application) {
        if (application == null) {
            throw new ValidationException("Application is null.");
        }
        if (application.getName() == null) {
            throw new ValidationException("Application name is mandatory.");
        }
        if (application.getServiceName() == null) {
            throw new ValidationException("Application service name is mandatory.");
        }
        if (application.getServiceType() == null) {
            throw new ValidationException("Application service type is mandatory.");
        }
    }
}
