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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.storagemover.models.CopyMode;
import com.azure.resourcemanager.storagemover.models.JobRunStatus;
import com.azure.resourcemanager.storagemover.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Job definition properties. */
@Fluent
public final class JobDefinitionProperties {
    /*
     * A description for the Job Definition.
     */
    @JsonProperty(value = "description")
    private String description;

    /*
     * Strategy to use for copy.
     */
    @JsonProperty(value = "copyMode", required = true)
    private CopyMode copyMode;

    /*
     * The name of the source Endpoint.
     */
    @JsonProperty(value = "sourceName", required = true)
    private String sourceName;

    /*
     * Fully qualified resource ID of the source Endpoint.
     */
    @JsonProperty(value = "sourceResourceId", access = JsonProperty.Access.WRITE_ONLY)
    private String sourceResourceId;

    /*
     * The subpath to use when reading from the source Endpoint.
     */
    @JsonProperty(value = "sourceSubpath")
    private String sourceSubpath;

    /*
     * The name of the target Endpoint.
     */
    @JsonProperty(value = "targetName", required = true)
    private String targetName;

    /*
     * Fully qualified resource ID of the target Endpoint.
     */
    @JsonProperty(value = "targetResourceId", access = JsonProperty.Access.WRITE_ONLY)
    private String targetResourceId;

    /*
     * The subpath to use when writing to the target Endpoint.
     */
    @JsonProperty(value = "targetSubpath")
    private String targetSubpath;

    /*
     * The name of the Job Run in a non-terminal state, if exists.
     */
    @JsonProperty(value = "latestJobRunName", access = JsonProperty.Access.WRITE_ONLY)
    private String latestJobRunName;

    /*
     * The fully qualified resource ID of the Job Run in a non-terminal state, if exists.
     */
    @JsonProperty(value = "latestJobRunResourceId", access = JsonProperty.Access.WRITE_ONLY)
    private String latestJobRunResourceId;

    /*
     * The current status of the Job Run in a non-terminal state, if exists.
     */
    @JsonProperty(value = "latestJobRunStatus", access = JsonProperty.Access.WRITE_ONLY)
    private JobRunStatus latestJobRunStatus;

    /*
     * Name of the Agent to assign for new Job Runs of this Job Definition.
     */
    @JsonProperty(value = "agentName")
    private String agentName;

    /*
     * Fully qualified resource id of the Agent to assign for new Job Runs of this Job Definition.
     */
    @JsonProperty(value = "agentResourceId", access = JsonProperty.Access.WRITE_ONLY)
    private String agentResourceId;

    /*
     * The provisioning state of this resource.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

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

    /**
     * Get the description property: A description for the Job Definition.
     *
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: A description for the Job Definition.
     *
     * @param description the description value to set.
     * @return the JobDefinitionProperties object itself.
     */
    public JobDefinitionProperties withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the copyMode property: Strategy to use for copy.
     *
     * @return the copyMode value.
     */
    public CopyMode copyMode() {
        return this.copyMode;
    }

    /**
     * Set the copyMode property: Strategy to use for copy.
     *
     * @param copyMode the copyMode value to set.
     * @return the JobDefinitionProperties object itself.
     */
    public JobDefinitionProperties withCopyMode(CopyMode copyMode) {
        this.copyMode = copyMode;
        return this;
    }

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

    /**
     * Set the sourceName property: The name of the source Endpoint.
     *
     * @param sourceName the sourceName value to set.
     * @return the JobDefinitionProperties object itself.
     */
    public JobDefinitionProperties withSourceName(String sourceName) {
        this.sourceName = sourceName;
        return this;
    }

    /**
     * Get the sourceResourceId property: Fully qualified resource ID of the source Endpoint.
     *
     * @return the sourceResourceId value.
     */
    public String sourceResourceId() {
        return this.sourceResourceId;
    }

    /**
     * Get the sourceSubpath property: The subpath to use when reading from the source Endpoint.
     *
     * @return the sourceSubpath value.
     */
    public String sourceSubpath() {
        return this.sourceSubpath;
    }

    /**
     * Set the sourceSubpath property: The subpath to use when reading from the source Endpoint.
     *
     * @param sourceSubpath the sourceSubpath value to set.
     * @return the JobDefinitionProperties object itself.
     */
    public JobDefinitionProperties withSourceSubpath(String sourceSubpath) {
        this.sourceSubpath = sourceSubpath;
        return this;
    }

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

    /**
     * Set the targetName property: The name of the target Endpoint.
     *
     * @param targetName the targetName value to set.
     * @return the JobDefinitionProperties object itself.
     */
    public JobDefinitionProperties withTargetName(String targetName) {
        this.targetName = targetName;
        return this;
    }

    /**
     * Get the targetResourceId property: Fully qualified resource ID of the target Endpoint.
     *
     * @return the targetResourceId value.
     */
    public String targetResourceId() {
        return this.targetResourceId;
    }

    /**
     * Get the targetSubpath property: The subpath to use when writing to the target Endpoint.
     *
     * @return the targetSubpath value.
     */
    public String targetSubpath() {
        return this.targetSubpath;
    }

    /**
     * Set the targetSubpath property: The subpath to use when writing to the target Endpoint.
     *
     * @param targetSubpath the targetSubpath value to set.
     * @return the JobDefinitionProperties object itself.
     */
    public JobDefinitionProperties withTargetSubpath(String targetSubpath) {
        this.targetSubpath = targetSubpath;
        return this;
    }

    /**
     * Get the latestJobRunName property: The name of the Job Run in a non-terminal state, if exists.
     *
     * @return the latestJobRunName value.
     */
    public String latestJobRunName() {
        return this.latestJobRunName;
    }

    /**
     * Get the latestJobRunResourceId property: The fully qualified resource ID of the Job Run in a non-terminal state,
     * if exists.
     *
     * @return the latestJobRunResourceId value.
     */
    public String latestJobRunResourceId() {
        return this.latestJobRunResourceId;
    }

    /**
     * Get the latestJobRunStatus property: The current status of the Job Run in a non-terminal state, if exists.
     *
     * @return the latestJobRunStatus value.
     */
    public JobRunStatus latestJobRunStatus() {
        return this.latestJobRunStatus;
    }

    /**
     * Get the agentName property: Name of the Agent to assign for new Job Runs of this Job Definition.
     *
     * @return the agentName value.
     */
    public String agentName() {
        return this.agentName;
    }

    /**
     * Set the agentName property: Name of the Agent to assign for new Job Runs of this Job Definition.
     *
     * @param agentName the agentName value to set.
     * @return the JobDefinitionProperties object itself.
     */
    public JobDefinitionProperties withAgentName(String agentName) {
        this.agentName = agentName;
        return this;
    }

    /**
     * Get the agentResourceId property: Fully qualified resource id of the Agent to assign for new Job Runs of this Job
     * Definition.
     *
     * @return the agentResourceId value.
     */
    public String agentResourceId() {
        return this.agentResourceId;
    }

    /**
     * Get the provisioningState property: The provisioning state of this resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

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

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