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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.videoanalyzer.models.ParameterDefinition;
import com.azure.resourcemanager.videoanalyzer.models.PipelineJobError;
import com.azure.resourcemanager.videoanalyzer.models.PipelineJobState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** Pipeline job properties. */
@Fluent
public final class PipelineJobPropertiesUpdate {
    /*
     * Reference to an existing pipeline topology. When activated, this
     * pipeline job will process content according to the pipeline topology
     * definition.
     */
    @JsonProperty(value = "topologyName")
    private String topologyName;

    /*
     * An optional description for the pipeline.
     */
    @JsonProperty(value = "description")
    private String description;

    /*
     * Current state of the pipeline (read-only).
     */
    @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY)
    private PipelineJobState state;

    /*
     * The date-time by when this pipeline job will be automatically deleted
     * from your account.
     */
    @JsonProperty(value = "expiration", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime expiration;

    /*
     * Details about the error, in case the pipeline job fails.
     */
    @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY)
    private PipelineJobError error;

    /*
     * List of the instance level parameter values for the user-defined
     * topology parameters. A pipeline can only define or override parameters
     * values for parameters which have been declared in the referenced
     * topology. Topology parameters without a default value must be defined.
     * Topology parameters with a default value can be optionally be
     * overridden.
     */
    @JsonProperty(value = "parameters")
    private List<ParameterDefinition> parameters;

    /**
     * Get the topologyName property: Reference to an existing pipeline topology. When activated, this pipeline job will
     * process content according to the pipeline topology definition.
     *
     * @return the topologyName value.
     */
    public String topologyName() {
        return this.topologyName;
    }

    /**
     * Set the topologyName property: Reference to an existing pipeline topology. When activated, this pipeline job will
     * process content according to the pipeline topology definition.
     *
     * @param topologyName the topologyName value to set.
     * @return the PipelineJobPropertiesUpdate object itself.
     */
    public PipelineJobPropertiesUpdate withTopologyName(String topologyName) {
        this.topologyName = topologyName;
        return this;
    }

    /**
     * Get the description property: An optional description for the pipeline.
     *
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: An optional description for the pipeline.
     *
     * @param description the description value to set.
     * @return the PipelineJobPropertiesUpdate object itself.
     */
    public PipelineJobPropertiesUpdate withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the state property: Current state of the pipeline (read-only).
     *
     * @return the state value.
     */
    public PipelineJobState state() {
        return this.state;
    }

    /**
     * Get the expiration property: The date-time by when this pipeline job will be automatically deleted from your
     * account.
     *
     * @return the expiration value.
     */
    public OffsetDateTime expiration() {
        return this.expiration;
    }

    /**
     * Get the error property: Details about the error, in case the pipeline job fails.
     *
     * @return the error value.
     */
    public PipelineJobError error() {
        return this.error;
    }

    /**
     * Get the parameters property: List of the instance level parameter values for the user-defined topology
     * parameters. A pipeline can only define or override parameters values for parameters which have been declared in
     * the referenced topology. Topology parameters without a default value must be defined. Topology parameters with a
     * default value can be optionally be overridden.
     *
     * @return the parameters value.
     */
    public List<ParameterDefinition> parameters() {
        return this.parameters;
    }

    /**
     * Set the parameters property: List of the instance level parameter values for the user-defined topology
     * parameters. A pipeline can only define or override parameters values for parameters which have been declared in
     * the referenced topology. Topology parameters without a default value must be defined. Topology parameters with a
     * default value can be optionally be overridden.
     *
     * @param parameters the parameters value to set.
     * @return the PipelineJobPropertiesUpdate object itself.
     */
    public PipelineJobPropertiesUpdate withParameters(List<ParameterDefinition> parameters) {
        this.parameters = parameters;
        return this;
    }

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