// 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.resourcemanager.automation.models.JobProvisioningState;
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.Map;
import java.util.UUID;

/** Definition of the job. */
@Fluent
public final class JobInner extends ProxyResource {
    /*
     * The properties of the job.
     */
    @JsonProperty(value = "properties")
    private JobProperties innerProperties;

    /**
     * Get the innerProperties property: The properties of the job.
     *
     * @return the innerProperties value.
     */
    private JobProperties innerProperties() {
        return this.innerProperties;
    }

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

    /**
     * Set the runbook property: Gets or sets the runbook.
     *
     * @param runbook the runbook value to set.
     * @return the JobInner object itself.
     */
    public JobInner withRunbook(RunbookAssociationProperty runbook) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withRunbook(runbook);
        return this;
    }

    /**
     * Get the startedBy property: Gets or sets the job started by.
     *
     * @return the startedBy value.
     */
    public String startedBy() {
        return this.innerProperties() == null ? null : this.innerProperties().startedBy();
    }

    /**
     * Set the startedBy property: Gets or sets the job started by.
     *
     * @param startedBy the startedBy value to set.
     * @return the JobInner object itself.
     */
    public JobInner withStartedBy(String startedBy) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withStartedBy(startedBy);
        return this;
    }

    /**
     * Get the runOn property: Gets or sets the runOn which specifies the group name where the job is to be executed.
     *
     * @return the runOn value.
     */
    public String runOn() {
        return this.innerProperties() == null ? null : this.innerProperties().runOn();
    }

    /**
     * Set the runOn property: Gets or sets the runOn which specifies the group name where the job is to be executed.
     *
     * @param runOn the runOn value to set.
     * @return the JobInner object itself.
     */
    public JobInner withRunOn(String runOn) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withRunOn(runOn);
        return this;
    }

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

    /**
     * Set the jobId property: Gets or sets the id of the job.
     *
     * @param jobId the jobId value to set.
     * @return the JobInner object itself.
     */
    public JobInner withJobId(UUID jobId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withJobId(jobId);
        return this;
    }

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

    /**
     * Set the creationTime property: Gets or sets the creation time of the job.
     *
     * @param creationTime the creationTime value to set.
     * @return the JobInner object itself.
     */
    public JobInner withCreationTime(OffsetDateTime creationTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withCreationTime(creationTime);
        return this;
    }

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

    /**
     * Set the status property: Gets or sets the status of the job.
     *
     * @param status the status value to set.
     * @return the JobInner object itself.
     */
    public JobInner withStatus(JobStatus status) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withStatus(status);
        return this;
    }

    /**
     * Get the statusDetails property: Gets or sets the status details of the job.
     *
     * @return the statusDetails value.
     */
    public String statusDetails() {
        return this.innerProperties() == null ? null : this.innerProperties().statusDetails();
    }

    /**
     * Set the statusDetails property: Gets or sets the status details of the job.
     *
     * @param statusDetails the statusDetails value to set.
     * @return the JobInner object itself.
     */
    public JobInner withStatusDetails(String statusDetails) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withStatusDetails(statusDetails);
        return this;
    }

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

    /**
     * Set the startTime property: Gets or sets the start time of the job.
     *
     * @param startTime the startTime value to set.
     * @return the JobInner object itself.
     */
    public JobInner withStartTime(OffsetDateTime startTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withStartTime(startTime);
        return this;
    }

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

    /**
     * Set the endTime property: Gets or sets the end time of the job.
     *
     * @param endTime the endTime value to set.
     * @return the JobInner object itself.
     */
    public JobInner withEndTime(OffsetDateTime endTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withEndTime(endTime);
        return this;
    }

    /**
     * Get the exception property: Gets or sets the exception of the job.
     *
     * @return the exception value.
     */
    public String exception() {
        return this.innerProperties() == null ? null : this.innerProperties().exception();
    }

    /**
     * Set the exception property: Gets or sets the exception of the job.
     *
     * @param exception the exception value to set.
     * @return the JobInner object itself.
     */
    public JobInner withException(String exception) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withException(exception);
        return this;
    }

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

    /**
     * Set the lastModifiedTime property: Gets or sets the last modified time of the job.
     *
     * @param lastModifiedTime the lastModifiedTime value to set.
     * @return the JobInner object itself.
     */
    public JobInner withLastModifiedTime(OffsetDateTime lastModifiedTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withLastModifiedTime(lastModifiedTime);
        return this;
    }

    /**
     * Get the lastStatusModifiedTime property: Gets or sets the last status modified time of the job.
     *
     * @return the lastStatusModifiedTime value.
     */
    public OffsetDateTime lastStatusModifiedTime() {
        return this.innerProperties() == null ? null : this.innerProperties().lastStatusModifiedTime();
    }

    /**
     * Set the lastStatusModifiedTime property: Gets or sets the last status modified time of the job.
     *
     * @param lastStatusModifiedTime the lastStatusModifiedTime value to set.
     * @return the JobInner object itself.
     */
    public JobInner withLastStatusModifiedTime(OffsetDateTime lastStatusModifiedTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withLastStatusModifiedTime(lastStatusModifiedTime);
        return this;
    }

    /**
     * Get the parameters property: Gets or sets the parameters of the job.
     *
     * @return the parameters value.
     */
    public Map<String, String> parameters() {
        return this.innerProperties() == null ? null : this.innerProperties().parameters();
    }

    /**
     * Set the parameters property: Gets or sets the parameters of the job.
     *
     * @param parameters the parameters value to set.
     * @return the JobInner object itself.
     */
    public JobInner withParameters(Map<String, String> parameters) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withParameters(parameters);
        return this;
    }

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

    /**
     * Set the provisioningState property: The current provisioning state of the job.
     *
     * @param provisioningState the provisioningState value to set.
     * @return the JobInner object itself.
     */
    public JobInner withProvisioningState(JobProvisioningState provisioningState) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withProvisioningState(provisioningState);
        return this;
    }

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