// 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.exception.ManagementError;
import com.azure.resourcemanager.automation.models.JobNavigation;
import com.azure.resourcemanager.automation.models.UpdateConfigurationNavigation;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.UUID;

/** Software update configuration machine run model. */
@Fluent
public final class SoftwareUpdateConfigurationMachineRunInner {
    /*
     * Name of the software update configuration machine run
     */
    @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
    private String name;

    /*
     * Resource Id of the software update configuration machine run
     */
    @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
    private String id;

    /*
     * Software update configuration machine run properties.
     */
    @JsonProperty(value = "properties")
    private UpdateConfigurationMachineRunProperties innerProperties;

    /**
     * Get the name property: Name of the software update configuration machine run.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Get the id property: Resource Id of the software update configuration machine run.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

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

    /**
     * Get the targetComputer property: name of the updated computer.
     *
     * @return the targetComputer value.
     */
    public String targetComputer() {
        return this.innerProperties() == null ? null : this.innerProperties().targetComputer();
    }

    /**
     * Get the targetComputerType property: type of the updated computer.
     *
     * @return the targetComputerType value.
     */
    public String targetComputerType() {
        return this.innerProperties() == null ? null : this.innerProperties().targetComputerType();
    }

    /**
     * Get the softwareUpdateConfiguration property: software update configuration triggered this run.
     *
     * @return the softwareUpdateConfiguration value.
     */
    public UpdateConfigurationNavigation softwareUpdateConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().softwareUpdateConfiguration();
    }

    /**
     * Set the softwareUpdateConfiguration property: software update configuration triggered this run.
     *
     * @param softwareUpdateConfiguration the softwareUpdateConfiguration value to set.
     * @return the SoftwareUpdateConfigurationMachineRunInner object itself.
     */
    public SoftwareUpdateConfigurationMachineRunInner withSoftwareUpdateConfiguration(
        UpdateConfigurationNavigation softwareUpdateConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateConfigurationMachineRunProperties();
        }
        this.innerProperties().withSoftwareUpdateConfiguration(softwareUpdateConfiguration);
        return this;
    }

    /**
     * Get the status property: Status of the software update configuration machine run.
     *
     * @return the status value.
     */
    public String status() {
        return this.innerProperties() == null ? null : this.innerProperties().status();
    }

    /**
     * Get the osType property: Operating system target of the software update configuration triggered this run.
     *
     * @return the osType value.
     */
    public String osType() {
        return this.innerProperties() == null ? null : this.innerProperties().osType();
    }

    /**
     * Get the correlationId property: correlation id of the software update configuration machine run.
     *
     * @return the correlationId value.
     */
    public UUID correlationId() {
        return this.innerProperties() == null ? null : this.innerProperties().correlationId();
    }

    /**
     * Get the sourceComputerId property: source computer id of the software update configuration machine run.
     *
     * @return the sourceComputerId value.
     */
    public UUID sourceComputerId() {
        return this.innerProperties() == null ? null : this.innerProperties().sourceComputerId();
    }

    /**
     * Get the startTime property: Start time of the software update configuration machine run.
     *
     * @return the startTime value.
     */
    public OffsetDateTime startTime() {
        return this.innerProperties() == null ? null : this.innerProperties().startTime();
    }

    /**
     * Get the endTime property: End time of the software update configuration machine run.
     *
     * @return the endTime value.
     */
    public OffsetDateTime endTime() {
        return this.innerProperties() == null ? null : this.innerProperties().endTime();
    }

    /**
     * Get the configuredDuration property: configured duration for the software update configuration run.
     *
     * @return the configuredDuration value.
     */
    public String configuredDuration() {
        return this.innerProperties() == null ? null : this.innerProperties().configuredDuration();
    }

    /**
     * Get the job property: Job associated with the software update configuration machine run.
     *
     * @return the job value.
     */
    public JobNavigation job() {
        return this.innerProperties() == null ? null : this.innerProperties().job();
    }

    /**
     * Set the job property: Job associated with the software update configuration machine run.
     *
     * @param job the job value to set.
     * @return the SoftwareUpdateConfigurationMachineRunInner object itself.
     */
    public SoftwareUpdateConfigurationMachineRunInner withJob(JobNavigation job) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateConfigurationMachineRunProperties();
        }
        this.innerProperties().withJob(job);
        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 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 SoftwareUpdateConfigurationMachineRunInner object itself.
     */
    public SoftwareUpdateConfigurationMachineRunInner withError(ManagementError error) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateConfigurationMachineRunProperties();
        }
        this.innerProperties().withError(error);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }
}
