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

package com.azure.resourcemanager.automation.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.automation.models.ContentSource;
import com.azure.resourcemanager.automation.models.DscConfigurationAssociationProperty;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The parameter properties supplied to the create or update node configuration operation. */
@Fluent
public final class DscNodeConfigurationCreateOrUpdateParametersProperties {
    /*
     * Gets or sets the source.
     */
    @JsonProperty(value = "source", required = true)
    private ContentSource source;

    /*
     * Gets or sets the configuration of the node.
     */
    @JsonProperty(value = "configuration", required = true)
    private DscConfigurationAssociationProperty configuration;

    /*
     * If a new build version of NodeConfiguration is required.
     */
    @JsonProperty(value = "incrementNodeConfigurationBuild")
    private Boolean incrementNodeConfigurationBuild;

    /**
     * Get the source property: Gets or sets the source.
     *
     * @return the source value.
     */
    public ContentSource source() {
        return this.source;
    }

    /**
     * Set the source property: Gets or sets the source.
     *
     * @param source the source value to set.
     * @return the DscNodeConfigurationCreateOrUpdateParametersProperties object itself.
     */
    public DscNodeConfigurationCreateOrUpdateParametersProperties withSource(ContentSource source) {
        this.source = source;
        return this;
    }

    /**
     * Get the configuration property: Gets or sets the configuration of the node.
     *
     * @return the configuration value.
     */
    public DscConfigurationAssociationProperty configuration() {
        return this.configuration;
    }

    /**
     * Set the configuration property: Gets or sets the configuration of the node.
     *
     * @param configuration the configuration value to set.
     * @return the DscNodeConfigurationCreateOrUpdateParametersProperties object itself.
     */
    public DscNodeConfigurationCreateOrUpdateParametersProperties withConfiguration(
        DscConfigurationAssociationProperty configuration) {
        this.configuration = configuration;
        return this;
    }

    /**
     * Get the incrementNodeConfigurationBuild property: If a new build version of NodeConfiguration is required.
     *
     * @return the incrementNodeConfigurationBuild value.
     */
    public Boolean incrementNodeConfigurationBuild() {
        return this.incrementNodeConfigurationBuild;
    }

    /**
     * Set the incrementNodeConfigurationBuild property: If a new build version of NodeConfiguration is required.
     *
     * @param incrementNodeConfigurationBuild the incrementNodeConfigurationBuild value to set.
     * @return the DscNodeConfigurationCreateOrUpdateParametersProperties object itself.
     */
    public DscNodeConfigurationCreateOrUpdateParametersProperties withIncrementNodeConfigurationBuild(
        Boolean incrementNodeConfigurationBuild) {
        this.incrementNodeConfigurationBuild = incrementNodeConfigurationBuild;
        return this;
    }

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

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