// 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.management.ProxyResource;
import com.azure.core.management.SystemData;
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;

/** The Job Definition resource. */
@Fluent
public final class JobDefinitionInner extends ProxyResource {
    /*
     * Job definition properties.
     */
    @JsonProperty(value = "properties", required = true)
    private JobDefinitionProperties innerProperties = new JobDefinitionProperties();

    /*
     * Resource system metadata.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

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

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

    /**
     * Get the systemData property: Resource system metadata.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * Set the targetSubpath property: The subpath to use when writing to the target Endpoint.
     *
     * @param targetSubpath the targetSubpath value to set.
     * @return the JobDefinitionInner object itself.
     */
    public JobDefinitionInner withTargetSubpath(String targetSubpath) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobDefinitionProperties();
        }
        this.innerProperties().withTargetSubpath(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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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 JobDefinitionInner object itself.
     */
    public JobDefinitionInner withAgentName(String agentName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobDefinitionProperties();
        }
        this.innerProperties().withAgentName(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.innerProperties() == null ? null : this.innerProperties().agentResourceId();
    }

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

    /**
     * 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 JobDefinitionInner"));
        } else {
            innerProperties().validate();
        }
    }

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