// 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.LivePipelineState;
import com.azure.resourcemanager.videoanalyzer.models.ParameterDefinition;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Live pipeline properties. */
@Fluent
public final class LivePipelinePropertiesUpdate {
    /*
     * The reference to an existing pipeline topology defined for real-time
     * content processing. When activated, this live pipeline 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;

    /*
     * Maximum bitrate capacity in Kbps reserved for the live pipeline. The
     * allowed range is from 500 to 3000 Kbps in increments of 100 Kbps. If the
     * RTSP camera exceeds this capacity, then the service will disconnect
     * temporarily from the camera. It will retry to re-establish connection
     * (with exponential backoff), checking to see if the camera bitrate is now
     * below the reserved capacity. Doing so will ensure that one 'noisy
     * neighbor' does not affect other live pipelines in your account.
     */
    @JsonProperty(value = "bitrateKbps")
    private Integer bitrateKbps;

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

    /*
     * 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: The reference to an existing pipeline topology defined for real-time content
     * processing. When activated, this live pipeline will process content according to the pipeline topology
     * definition.
     *
     * @return the topologyName value.
     */
    public String topologyName() {
        return this.topologyName;
    }

    /**
     * Set the topologyName property: The reference to an existing pipeline topology defined for real-time content
     * processing. When activated, this live pipeline will process content according to the pipeline topology
     * definition.
     *
     * @param topologyName the topologyName value to set.
     * @return the LivePipelinePropertiesUpdate object itself.
     */
    public LivePipelinePropertiesUpdate 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 LivePipelinePropertiesUpdate object itself.
     */
    public LivePipelinePropertiesUpdate withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the bitrateKbps property: Maximum bitrate capacity in Kbps reserved for the live pipeline. The allowed range
     * is from 500 to 3000 Kbps in increments of 100 Kbps. If the RTSP camera exceeds this capacity, then the service
     * will disconnect temporarily from the camera. It will retry to re-establish connection (with exponential backoff),
     * checking to see if the camera bitrate is now below the reserved capacity. Doing so will ensure that one 'noisy
     * neighbor' does not affect other live pipelines in your account.
     *
     * @return the bitrateKbps value.
     */
    public Integer bitrateKbps() {
        return this.bitrateKbps;
    }

    /**
     * Set the bitrateKbps property: Maximum bitrate capacity in Kbps reserved for the live pipeline. The allowed range
     * is from 500 to 3000 Kbps in increments of 100 Kbps. If the RTSP camera exceeds this capacity, then the service
     * will disconnect temporarily from the camera. It will retry to re-establish connection (with exponential backoff),
     * checking to see if the camera bitrate is now below the reserved capacity. Doing so will ensure that one 'noisy
     * neighbor' does not affect other live pipelines in your account.
     *
     * @param bitrateKbps the bitrateKbps value to set.
     * @return the LivePipelinePropertiesUpdate object itself.
     */
    public LivePipelinePropertiesUpdate withBitrateKbps(Integer bitrateKbps) {
        this.bitrateKbps = bitrateKbps;
        return this;
    }

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

    /**
     * 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 LivePipelinePropertiesUpdate object itself.
     */
    public LivePipelinePropertiesUpdate 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 (parameters() != null) {
            parameters().forEach(e -> e.validate());
        }
    }
}
