// 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.management.ProxyResource;
import com.azure.core.management.exception.ManagementError;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.automation.models.SoftwareUpdateConfigurationTasks;
import com.azure.resourcemanager.automation.models.SucScheduleProperties;
import com.azure.resourcemanager.automation.models.UpdateConfiguration;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** Software update configuration properties. */
@Fluent
public final class SoftwareUpdateConfigurationInner extends ProxyResource {
    /*
     * Software update configuration properties.
     */
    @JsonProperty(value = "properties", required = true)
    private SoftwareUpdateConfigurationProperties innerProperties = new SoftwareUpdateConfigurationProperties();

    /**
     * Get the innerProperties property: Software update configuration properties.
     *
     * @return the innerProperties value.
     */
    private SoftwareUpdateConfigurationProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the updateConfiguration property: update specific properties for the Software update configuration.
     *
     * @return the updateConfiguration value.
     */
    public UpdateConfiguration updateConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().updateConfiguration();
    }

    /**
     * Set the updateConfiguration property: update specific properties for the Software update configuration.
     *
     * @param updateConfiguration the updateConfiguration value to set.
     * @return the SoftwareUpdateConfigurationInner object itself.
     */
    public SoftwareUpdateConfigurationInner withUpdateConfiguration(UpdateConfiguration updateConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SoftwareUpdateConfigurationProperties();
        }
        this.innerProperties().withUpdateConfiguration(updateConfiguration);
        return this;
    }

    /**
     * Get the scheduleInfo property: Schedule information for the Software update configuration.
     *
     * @return the scheduleInfo value.
     */
    public SucScheduleProperties scheduleInfo() {
        return this.innerProperties() == null ? null : this.innerProperties().scheduleInfo();
    }

    /**
     * Set the scheduleInfo property: Schedule information for the Software update configuration.
     *
     * @param scheduleInfo the scheduleInfo value to set.
     * @return the SoftwareUpdateConfigurationInner object itself.
     */
    public SoftwareUpdateConfigurationInner withScheduleInfo(SucScheduleProperties scheduleInfo) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SoftwareUpdateConfigurationProperties();
        }
        this.innerProperties().withScheduleInfo(scheduleInfo);
        return this;
    }

    /**
     * Get the provisioningState property: Provisioning state for the software update configuration, which only appears
     * in the response.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the error property: Details of provisioning error.
     *
     * @return the error value.
     */
    public ManagementError error() {
        return this.innerProperties() == null ? null : this.innerProperties().error();
    }

    /**
     * Set the error property: Details of provisioning error.
     *
     * @param error the error value to set.
     * @return the SoftwareUpdateConfigurationInner object itself.
     */
    public SoftwareUpdateConfigurationInner withError(ManagementError error) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SoftwareUpdateConfigurationProperties();
        }
        this.innerProperties().withError(error);
        return this;
    }

    /**
     * Get the creationTime property: Creation time of the resource, which only appears in the response.
     *
     * @return the creationTime value.
     */
    public OffsetDateTime creationTime() {
        return this.innerProperties() == null ? null : this.innerProperties().creationTime();
    }

    /**
     * Get the createdBy property: CreatedBy property, which only appears in the response.
     *
     * @return the createdBy value.
     */
    public String createdBy() {
        return this.innerProperties() == null ? null : this.innerProperties().createdBy();
    }

    /**
     * Get the lastModifiedTime property: Last time resource was modified, which only appears in the response.
     *
     * @return the lastModifiedTime value.
     */
    public OffsetDateTime lastModifiedTime() {
        return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTime();
    }

    /**
     * Get the lastModifiedBy property: LastModifiedBy property, which only appears in the response.
     *
     * @return the lastModifiedBy value.
     */
    public String lastModifiedBy() {
        return this.innerProperties() == null ? null : this.innerProperties().lastModifiedBy();
    }

    /**
     * Get the tasks property: Tasks information for the Software update configuration.
     *
     * @return the tasks value.
     */
    public SoftwareUpdateConfigurationTasks tasks() {
        return this.innerProperties() == null ? null : this.innerProperties().tasks();
    }

    /**
     * Set the tasks property: Tasks information for the Software update configuration.
     *
     * @param tasks the tasks value to set.
     * @return the SoftwareUpdateConfigurationInner object itself.
     */
    public SoftwareUpdateConfigurationInner withTasks(SoftwareUpdateConfigurationTasks tasks) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SoftwareUpdateConfigurationProperties();
        }
        this.innerProperties().withTasks(tasks);
        return this;
    }

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

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