// 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.util.logging.ClientLogger;
import com.azure.resourcemanager.automation.models.JobStatus;
import com.azure.resourcemanager.automation.models.RunbookAssociationProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.UUID;

/** Job collection item properties. */
@Fluent
public final class JobCollectionItemInner extends ProxyResource {
    /*
     * Job properties.
     */
    @JsonProperty(value = "properties", required = true)
    private JobCollectionItemProperties innerProperties = new JobCollectionItemProperties();

    /**
     * Get the innerProperties property: Job properties.
     *
     * @return the innerProperties value.
     */
    private JobCollectionItemProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the runbook property: The runbook association.
     *
     * @return the runbook value.
     */
    public RunbookAssociationProperty runbook() {
        return this.innerProperties() == null ? null : this.innerProperties().runbook();
    }

    /**
     * Get the jobId property: The id of the job.
     *
     * @return the jobId value.
     */
    public UUID jobId() {
        return this.innerProperties() == null ? null : this.innerProperties().jobId();
    }

    /**
     * Get the creationTime property: The creation time of the job.
     *
     * @return the creationTime value.
     */
    public OffsetDateTime creationTime() {
        return this.innerProperties() == null ? null : this.innerProperties().creationTime();
    }

    /**
     * Get the status property: The status of the job.
     *
     * @return the status value.
     */
    public JobStatus status() {
        return this.innerProperties() == null ? null : this.innerProperties().status();
    }

    /**
     * Get the startTime property: The start time of the job.
     *
     * @return the startTime value.
     */
    public OffsetDateTime startTime() {
        return this.innerProperties() == null ? null : this.innerProperties().startTime();
    }

    /**
     * Get the endTime property: The end time of the job.
     *
     * @return the endTime value.
     */
    public OffsetDateTime endTime() {
        return this.innerProperties() == null ? null : this.innerProperties().endTime();
    }

    /**
     * Get the lastModifiedTime property: The last modified time of the job.
     *
     * @return the lastModifiedTime value.
     */
    public OffsetDateTime lastModifiedTime() {
        return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTime();
    }

    /**
     * Get the provisioningState property: The provisioning state of a resource.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the runOn property: Specifies the runOn group name where the job was executed.
     *
     * @return the runOn value.
     */
    public String runOn() {
        return this.innerProperties() == null ? null : this.innerProperties().runOn();
    }

    /**
     * Set the runOn property: Specifies the runOn group name where the job was executed.
     *
     * @param runOn the runOn value to set.
     * @return the JobCollectionItemInner object itself.
     */
    public JobCollectionItemInner withRunOn(String runOn) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobCollectionItemProperties();
        }
        this.innerProperties().withRunOn(runOn);
        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 JobCollectionItemInner"));
        } else {
            innerProperties().validate();
        }
    }

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