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

package com.azure.resourcemanager.storagecache.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** A priming job instance. */
@Fluent
public final class PrimingJob {
    /*
     * The priming job name.
     */
    @JsonProperty(value = "primingJobName", required = true)
    private String primingJobName;

    /*
     * The URL for the priming manifest file to download. This file must be readable from the HPC Cache. When the file
     * is in Azure blob storage the URL should include a Shared Access Signature (SAS) granting read permissions on the
     * blob.
     */
    @JsonProperty(value = "primingManifestUrl", required = true)
    private String primingManifestUrl;

    /*
     * The unique identifier of the priming job.
     */
    @JsonProperty(value = "primingJobId", access = JsonProperty.Access.WRITE_ONLY)
    private String primingJobId;

    /*
     * The state of the priming operation.
     */
    @JsonProperty(value = "primingJobState", access = JsonProperty.Access.WRITE_ONLY)
    private PrimingJobState primingJobState;

    /*
     * The status code of the priming job.
     */
    @JsonProperty(value = "primingJobStatus", access = JsonProperty.Access.WRITE_ONLY)
    private String primingJobStatus;

    /*
     * The job details or error information if any.
     */
    @JsonProperty(value = "primingJobDetails", access = JsonProperty.Access.WRITE_ONLY)
    private String primingJobDetails;

    /*
     * The current progress of the priming job, as a percentage.
     */
    @JsonProperty(value = "primingJobPercentComplete", access = JsonProperty.Access.WRITE_ONLY)
    private Double primingJobPercentComplete;

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

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

    /**
     * Set the primingJobName property: The priming job name.
     *
     * @param primingJobName the primingJobName value to set.
     * @return the PrimingJob object itself.
     */
    public PrimingJob withPrimingJobName(String primingJobName) {
        this.primingJobName = primingJobName;
        return this;
    }

    /**
     * Get the primingManifestUrl property: The URL for the priming manifest file to download. This file must be
     * readable from the HPC Cache. When the file is in Azure blob storage the URL should include a Shared Access
     * Signature (SAS) granting read permissions on the blob.
     *
     * @return the primingManifestUrl value.
     */
    public String primingManifestUrl() {
        return this.primingManifestUrl;
    }

    /**
     * Set the primingManifestUrl property: The URL for the priming manifest file to download. This file must be
     * readable from the HPC Cache. When the file is in Azure blob storage the URL should include a Shared Access
     * Signature (SAS) granting read permissions on the blob.
     *
     * @param primingManifestUrl the primingManifestUrl value to set.
     * @return the PrimingJob object itself.
     */
    public PrimingJob withPrimingManifestUrl(String primingManifestUrl) {
        this.primingManifestUrl = primingManifestUrl;
        return this;
    }

    /**
     * Get the primingJobId property: The unique identifier of the priming job.
     *
     * @return the primingJobId value.
     */
    public String primingJobId() {
        return this.primingJobId;
    }

    /**
     * Get the primingJobState property: The state of the priming operation.
     *
     * @return the primingJobState value.
     */
    public PrimingJobState primingJobState() {
        return this.primingJobState;
    }

    /**
     * Get the primingJobStatus property: The status code of the priming job.
     *
     * @return the primingJobStatus value.
     */
    public String primingJobStatus() {
        return this.primingJobStatus;
    }

    /**
     * Get the primingJobDetails property: The job details or error information if any.
     *
     * @return the primingJobDetails value.
     */
    public String primingJobDetails() {
        return this.primingJobDetails;
    }

    /**
     * Get the primingJobPercentComplete property: The current progress of the priming job, as a percentage.
     *
     * @return the primingJobPercentComplete value.
     */
    public Double primingJobPercentComplete() {
        return this.primingJobPercentComplete;
    }

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

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