// 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.resourcemanager.automation.models.ContentSource;
import com.azure.resourcemanager.automation.models.DscConfigurationParameter;
import com.azure.resourcemanager.automation.models.DscConfigurationProvisioningState;
import com.azure.resourcemanager.automation.models.DscConfigurationState;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

/** Definition of the configuration property type. */
@Fluent
public final class DscConfigurationProperties {
    /*
     * Gets or sets the provisioning state of the configuration.
     */
    @JsonProperty(value = "provisioningState")
    private DscConfigurationProvisioningState provisioningState;

    /*
     * Gets or sets the job count of the configuration.
     */
    @JsonProperty(value = "jobCount")
    private Integer jobCount;

    /*
     * Gets or sets the configuration parameters.
     */
    @JsonProperty(value = "parameters")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, DscConfigurationParameter> parameters;

    /*
     * Gets or sets the source.
     */
    @JsonProperty(value = "source")
    private ContentSource source;

    /*
     * Gets or sets the state of the configuration.
     */
    @JsonProperty(value = "state")
    private DscConfigurationState state;

    /*
     * Gets or sets verbose log option.
     */
    @JsonProperty(value = "logVerbose")
    private Boolean logVerbose;

    /*
     * Gets or sets the creation time.
     */
    @JsonProperty(value = "creationTime")
    private OffsetDateTime creationTime;

    /*
     * Gets or sets the last modified time.
     */
    @JsonProperty(value = "lastModifiedTime")
    private OffsetDateTime lastModifiedTime;

    /*
     * Gets the number of compiled node configurations.
     */
    @JsonProperty(value = "nodeConfigurationCount")
    private Integer nodeConfigurationCount;

    /*
     * Gets or sets the description.
     */
    @JsonProperty(value = "description")
    private String description;

    /**
     * Get the provisioningState property: Gets or sets the provisioning state of the configuration.
     *
     * @return the provisioningState value.
     */
    public DscConfigurationProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Set the provisioningState property: Gets or sets the provisioning state of the configuration.
     *
     * @param provisioningState the provisioningState value to set.
     * @return the DscConfigurationProperties object itself.
     */
    public DscConfigurationProperties withProvisioningState(DscConfigurationProvisioningState provisioningState) {
        this.provisioningState = provisioningState;
        return this;
    }

    /**
     * Get the jobCount property: Gets or sets the job count of the configuration.
     *
     * @return the jobCount value.
     */
    public Integer jobCount() {
        return this.jobCount;
    }

    /**
     * Set the jobCount property: Gets or sets the job count of the configuration.
     *
     * @param jobCount the jobCount value to set.
     * @return the DscConfigurationProperties object itself.
     */
    public DscConfigurationProperties withJobCount(Integer jobCount) {
        this.jobCount = jobCount;
        return this;
    }

    /**
     * Get the parameters property: Gets or sets the configuration parameters.
     *
     * @return the parameters value.
     */
    public Map<String, DscConfigurationParameter> parameters() {
        return this.parameters;
    }

    /**
     * Set the parameters property: Gets or sets the configuration parameters.
     *
     * @param parameters the parameters value to set.
     * @return the DscConfigurationProperties object itself.
     */
    public DscConfigurationProperties withParameters(Map<String, DscConfigurationParameter> parameters) {
        this.parameters = parameters;
        return this;
    }

    /**
     * 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 DscConfigurationProperties object itself.
     */
    public DscConfigurationProperties withSource(ContentSource source) {
        this.source = source;
        return this;
    }

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

    /**
     * Set the state property: Gets or sets the state of the configuration.
     *
     * @param state the state value to set.
     * @return the DscConfigurationProperties object itself.
     */
    public DscConfigurationProperties withState(DscConfigurationState state) {
        this.state = state;
        return this;
    }

    /**
     * Get the logVerbose property: Gets or sets verbose log option.
     *
     * @return the logVerbose value.
     */
    public Boolean logVerbose() {
        return this.logVerbose;
    }

    /**
     * Set the logVerbose property: Gets or sets verbose log option.
     *
     * @param logVerbose the logVerbose value to set.
     * @return the DscConfigurationProperties object itself.
     */
    public DscConfigurationProperties withLogVerbose(Boolean logVerbose) {
        this.logVerbose = logVerbose;
        return this;
    }

    /**
     * Get the creationTime property: Gets or sets the creation time.
     *
     * @return the creationTime value.
     */
    public OffsetDateTime creationTime() {
        return this.creationTime;
    }

    /**
     * Set the creationTime property: Gets or sets the creation time.
     *
     * @param creationTime the creationTime value to set.
     * @return the DscConfigurationProperties object itself.
     */
    public DscConfigurationProperties withCreationTime(OffsetDateTime creationTime) {
        this.creationTime = creationTime;
        return this;
    }

    /**
     * Get the lastModifiedTime property: Gets or sets the last modified time.
     *
     * @return the lastModifiedTime value.
     */
    public OffsetDateTime lastModifiedTime() {
        return this.lastModifiedTime;
    }

    /**
     * Set the lastModifiedTime property: Gets or sets the last modified time.
     *
     * @param lastModifiedTime the lastModifiedTime value to set.
     * @return the DscConfigurationProperties object itself.
     */
    public DscConfigurationProperties withLastModifiedTime(OffsetDateTime lastModifiedTime) {
        this.lastModifiedTime = lastModifiedTime;
        return this;
    }

    /**
     * Get the nodeConfigurationCount property: Gets the number of compiled node configurations.
     *
     * @return the nodeConfigurationCount value.
     */
    public Integer nodeConfigurationCount() {
        return this.nodeConfigurationCount;
    }

    /**
     * Set the nodeConfigurationCount property: Gets the number of compiled node configurations.
     *
     * @param nodeConfigurationCount the nodeConfigurationCount value to set.
     * @return the DscConfigurationProperties object itself.
     */
    public DscConfigurationProperties withNodeConfigurationCount(Integer nodeConfigurationCount) {
        this.nodeConfigurationCount = nodeConfigurationCount;
        return this;
    }

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

    /**
     * Set the description property: Gets or sets the description.
     *
     * @param description the description value to set.
     * @return the DscConfigurationProperties object itself.
     */
    public DscConfigurationProperties withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (parameters() != null) {
            parameters()
                .values()
                .forEach(
                    e -> {
                        if (e != null) {
                            e.validate();
                        }
                    });
        }
        if (source() != null) {
            source().validate();
        }
    }
}
