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

package com.azure.resourcemanager.mediaservices.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.time.Duration;

/** Describes the properties of a video overlay. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@odata.type")
@JsonTypeName("#Microsoft.Media.VideoOverlay")
@Fluent
public final class VideoOverlay extends Overlay {
    /*
     * The location in the input video where the overlay is applied.
     */
    @JsonProperty(value = "position")
    private Rectangle position;

    /*
     * The opacity of the overlay. This is a value in the range [0 - 1.0]. Default is 1.0 which mean the overlay is
     * opaque.
     */
    @JsonProperty(value = "opacity")
    private Double opacity;

    /*
     * An optional rectangular window used to crop the overlay image or video.
     */
    @JsonProperty(value = "cropRectangle")
    private Rectangle cropRectangle;

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

    /**
     * Get the position property: The location in the input video where the overlay is applied.
     *
     * @return the position value.
     */
    public Rectangle position() {
        return this.position;
    }

    /**
     * Set the position property: The location in the input video where the overlay is applied.
     *
     * @param position the position value to set.
     * @return the VideoOverlay object itself.
     */
    public VideoOverlay withPosition(Rectangle position) {
        this.position = position;
        return this;
    }

    /**
     * Get the opacity property: The opacity of the overlay. This is a value in the range [0 - 1.0]. Default is 1.0
     * which mean the overlay is opaque.
     *
     * @return the opacity value.
     */
    public Double opacity() {
        return this.opacity;
    }

    /**
     * Set the opacity property: The opacity of the overlay. This is a value in the range [0 - 1.0]. Default is 1.0
     * which mean the overlay is opaque.
     *
     * @param opacity the opacity value to set.
     * @return the VideoOverlay object itself.
     */
    public VideoOverlay withOpacity(Double opacity) {
        this.opacity = opacity;
        return this;
    }

    /**
     * Get the cropRectangle property: An optional rectangular window used to crop the overlay image or video.
     *
     * @return the cropRectangle value.
     */
    public Rectangle cropRectangle() {
        return this.cropRectangle;
    }

    /**
     * Set the cropRectangle property: An optional rectangular window used to crop the overlay image or video.
     *
     * @param cropRectangle the cropRectangle value to set.
     * @return the VideoOverlay object itself.
     */
    public VideoOverlay withCropRectangle(Rectangle cropRectangle) {
        this.cropRectangle = cropRectangle;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public VideoOverlay withInputLabel(String inputLabel) {
        super.withInputLabel(inputLabel);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public VideoOverlay withStart(Duration start) {
        super.withStart(start);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public VideoOverlay withEnd(Duration end) {
        super.withEnd(end);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public VideoOverlay withFadeInDuration(Duration fadeInDuration) {
        super.withFadeInDuration(fadeInDuration);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public VideoOverlay withFadeOutDuration(Duration fadeOutDuration) {
        super.withFadeOutDuration(fadeOutDuration);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public VideoOverlay withAudioGainLevel(Double audioGainLevel) {
        super.withAudioGainLevel(audioGainLevel);
        return this;
    }

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