// 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.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/**
 * Base type for all video encoding presets, which define the recipe or instructions on how the input video should be
 * processed.
 */
@JsonTypeInfo(
    use = JsonTypeInfo.Id.NAME,
    include = JsonTypeInfo.As.PROPERTY,
    property = "@type",
    defaultImpl = VideoEncoderBase.class)
@JsonTypeName("VideoEncoderBase")
@JsonSubTypes({@JsonSubTypes.Type(name = "#Microsoft.VideoAnalyzer.VideoEncoderH264", value = VideoEncoderH264.class)})
@Fluent
public class VideoEncoderBase {
    /*
     * The maximum bitrate, in kilobits per second or Kbps, at which video
     * should be encoded. If omitted, encoder sets it automatically to try and
     * match the quality of the input video.
     */
    @JsonProperty(value = "bitrateKbps")
    private String bitrateKbps;

    /*
     * The frame rate (in frames per second) of the encoded video. The value
     * must be greater than zero, and less than or equal to 300. If omitted,
     * the encoder uses the average frame rate of the input video.
     */
    @JsonProperty(value = "frameRate")
    private String frameRate;

    /*
     * Describes the resolution of the encoded video. If omitted, the encoder
     * uses the resolution of the input video.
     */
    @JsonProperty(value = "scale")
    private VideoScale scale;

    /**
     * Get the bitrateKbps property: The maximum bitrate, in kilobits per second or Kbps, at which video should be
     * encoded. If omitted, encoder sets it automatically to try and match the quality of the input video.
     *
     * @return the bitrateKbps value.
     */
    public String bitrateKbps() {
        return this.bitrateKbps;
    }

    /**
     * Set the bitrateKbps property: The maximum bitrate, in kilobits per second or Kbps, at which video should be
     * encoded. If omitted, encoder sets it automatically to try and match the quality of the input video.
     *
     * @param bitrateKbps the bitrateKbps value to set.
     * @return the VideoEncoderBase object itself.
     */
    public VideoEncoderBase withBitrateKbps(String bitrateKbps) {
        this.bitrateKbps = bitrateKbps;
        return this;
    }

    /**
     * Get the frameRate property: The frame rate (in frames per second) of the encoded video. The value must be greater
     * than zero, and less than or equal to 300. If omitted, the encoder uses the average frame rate of the input video.
     *
     * @return the frameRate value.
     */
    public String frameRate() {
        return this.frameRate;
    }

    /**
     * Set the frameRate property: The frame rate (in frames per second) of the encoded video. The value must be greater
     * than zero, and less than or equal to 300. If omitted, the encoder uses the average frame rate of the input video.
     *
     * @param frameRate the frameRate value to set.
     * @return the VideoEncoderBase object itself.
     */
    public VideoEncoderBase withFrameRate(String frameRate) {
        this.frameRate = frameRate;
        return this;
    }

    /**
     * Get the scale property: Describes the resolution of the encoded video. If omitted, the encoder uses the
     * resolution of the input video.
     *
     * @return the scale value.
     */
    public VideoScale scale() {
        return this.scale;
    }

    /**
     * Set the scale property: Describes the resolution of the encoded video. If omitted, the encoder uses the
     * resolution of the input video.
     *
     * @param scale the scale value to set.
     * @return the VideoEncoderBase object itself.
     */
    public VideoEncoderBase withScale(VideoScale scale) {
        this.scale = scale;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (scale() != null) {
            scale().validate();
        }
    }
}
