// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.providerhub.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The TemplateDeploymentPolicy model. */
@Fluent
public class TemplateDeploymentPolicy {
    /*
     * The capabilities property.
     */
    @JsonProperty(value = "capabilities", required = true)
    private TemplateDeploymentCapabilities capabilities;

    /*
     * The preflightOptions property.
     */
    @JsonProperty(value = "preflightOptions", required = true)
    private TemplateDeploymentPreflightOptions preflightOptions;

    /** Creates an instance of TemplateDeploymentPolicy class. */
    public TemplateDeploymentPolicy() {
    }

    /**
     * Get the capabilities property: The capabilities property.
     *
     * @return the capabilities value.
     */
    public TemplateDeploymentCapabilities capabilities() {
        return this.capabilities;
    }

    /**
     * Set the capabilities property: The capabilities property.
     *
     * @param capabilities the capabilities value to set.
     * @return the TemplateDeploymentPolicy object itself.
     */
    public TemplateDeploymentPolicy withCapabilities(TemplateDeploymentCapabilities capabilities) {
        this.capabilities = capabilities;
        return this;
    }

    /**
     * Get the preflightOptions property: The preflightOptions property.
     *
     * @return the preflightOptions value.
     */
    public TemplateDeploymentPreflightOptions preflightOptions() {
        return this.preflightOptions;
    }

    /**
     * Set the preflightOptions property: The preflightOptions property.
     *
     * @param preflightOptions the preflightOptions value to set.
     * @return the TemplateDeploymentPolicy object itself.
     */
    public TemplateDeploymentPolicy withPreflightOptions(TemplateDeploymentPreflightOptions preflightOptions) {
        this.preflightOptions = preflightOptions;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (capabilities() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property capabilities in model TemplateDeploymentPolicy"));
        }
        if (preflightOptions() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property preflightOptions in model TemplateDeploymentPolicy"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(TemplateDeploymentPolicy.class);
}
