// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.databoxedge.fluent.models;

import com.azure.core.annotation.Immutable;
import com.azure.resourcemanager.databoxedge.models.JobErrorDetails;
import com.azure.resourcemanager.databoxedge.models.JobStatus;
import com.azure.resourcemanager.databoxedge.models.JobType;
import com.azure.resourcemanager.databoxedge.models.UpdateDownloadProgress;
import com.azure.resourcemanager.databoxedge.models.UpdateInstallProgress;
import com.azure.resourcemanager.databoxedge.models.UpdateOperationStage;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** A device job. */
@Immutable
public final class JobInner {
    /*
     * The path ID that uniquely identifies the object.
     */
    @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
    private String id;

    /*
     * The name of the object.
     */
    @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
    private String name;

    /*
     * The hierarchical type of the object.
     */
    @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY)
    private String type;

    /*
     * The current status of the job.
     */
    @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
    private JobStatus status;

    /*
     * The UTC date and time at which the job started.
     */
    @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime startTime;

    /*
     * The UTC date and time at which the job completed.
     */
    @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime endTime;

    /*
     * The percentage of the job that is complete.
     */
    @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY)
    private Integer percentComplete;

    /*
     * The error details.
     */
    @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY)
    private JobErrorDetails error;

    /*
     * The properties of the job.
     */
    @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY)
    private JobProperties innerProperties;

    /** Creates an instance of JobInner class. */
    public JobInner() {
    }

    /**
     * Get the id property: The path ID that uniquely identifies the object.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Get the name property: The name of the object.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Get the type property: The hierarchical type of the object.
     *
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

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

    /**
     * Get the startTime property: The UTC date and time at which the job started.
     *
     * @return the startTime value.
     */
    public OffsetDateTime startTime() {
        return this.startTime;
    }

    /**
     * Get the endTime property: The UTC date and time at which the job completed.
     *
     * @return the endTime value.
     */
    public OffsetDateTime endTime() {
        return this.endTime;
    }

    /**
     * Get the percentComplete property: The percentage of the job that is complete.
     *
     * @return the percentComplete value.
     */
    public Integer percentComplete() {
        return this.percentComplete;
    }

    /**
     * Get the error property: The error details.
     *
     * @return the error value.
     */
    public JobErrorDetails error() {
        return this.error;
    }

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

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

    /**
     * Get the currentStage property: Current stage of the update operation.
     *
     * @return the currentStage value.
     */
    public UpdateOperationStage currentStage() {
        return this.innerProperties() == null ? null : this.innerProperties().currentStage();
    }

    /**
     * Get the downloadProgress property: The download progress.
     *
     * @return the downloadProgress value.
     */
    public UpdateDownloadProgress downloadProgress() {
        return this.innerProperties() == null ? null : this.innerProperties().downloadProgress();
    }

    /**
     * Get the installProgress property: The install progress.
     *
     * @return the installProgress value.
     */
    public UpdateInstallProgress installProgress() {
        return this.innerProperties() == null ? null : this.innerProperties().installProgress();
    }

    /**
     * Get the totalRefreshErrors property: Total number of errors encountered during the refresh process.
     *
     * @return the totalRefreshErrors value.
     */
    public Integer totalRefreshErrors() {
        return this.innerProperties() == null ? null : this.innerProperties().totalRefreshErrors();
    }

    /**
     * Get the errorManifestFile property: Local share/remote container relative path to the error manifest file of the
     * refresh.
     *
     * @return the errorManifestFile value.
     */
    public String errorManifestFile() {
        return this.innerProperties() == null ? null : this.innerProperties().errorManifestFile();
    }

    /**
     * Get the refreshedEntityId property: ARM ID of the entity that was refreshed.
     *
     * @return the refreshedEntityId value.
     */
    public String refreshedEntityId() {
        return this.innerProperties() == null ? null : this.innerProperties().refreshedEntityId();
    }

    /**
     * Get the folder property: If only subfolders need to be refreshed, then the subfolder path inside the share or
     * container. (The path is empty if there are no subfolders.).
     *
     * @return the folder value.
     */
    public String folder() {
        return this.innerProperties() == null ? null : this.innerProperties().folder();
    }

    /**
     * Set the folder property: If only subfolders need to be refreshed, then the subfolder path inside the share or
     * container. (The path is empty if there are no subfolders.).
     *
     * @param folder the folder value to set.
     * @return the JobInner object itself.
     */
    public JobInner withFolder(String folder) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withFolder(folder);
        return this;
    }

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