// 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.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Class to specify one track property condition. */
@Fluent
public final class TrackPropertyCondition {
    /*
     * Track property type
     */
    @JsonProperty(value = "property", required = true)
    private TrackPropertyType property;

    /*
     * Track property condition operation
     */
    @JsonProperty(value = "operation", required = true)
    private TrackPropertyCompareOperation operation;

    /*
     * Track property value
     */
    @JsonProperty(value = "value")
    private String value;

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

    /**
     * Get the property property: Track property type.
     *
     * @return the property value.
     */
    public TrackPropertyType property() {
        return this.property;
    }

    /**
     * Set the property property: Track property type.
     *
     * @param property the property value to set.
     * @return the TrackPropertyCondition object itself.
     */
    public TrackPropertyCondition withProperty(TrackPropertyType property) {
        this.property = property;
        return this;
    }

    /**
     * Get the operation property: Track property condition operation.
     *
     * @return the operation value.
     */
    public TrackPropertyCompareOperation operation() {
        return this.operation;
    }

    /**
     * Set the operation property: Track property condition operation.
     *
     * @param operation the operation value to set.
     * @return the TrackPropertyCondition object itself.
     */
    public TrackPropertyCondition withOperation(TrackPropertyCompareOperation operation) {
        this.operation = operation;
        return this;
    }

    /**
     * Get the value property: Track property value.
     *
     * @return the value value.
     */
    public String value() {
        return this.value;
    }

    /**
     * Set the value property: Track property value.
     *
     * @param value the value value to set.
     * @return the TrackPropertyCondition object itself.
     */
    public TrackPropertyCondition withValue(String value) {
        this.value = value;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (property() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property property in model TrackPropertyCondition"));
        }
        if (operation() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property operation in model TrackPropertyCondition"));
        }
    }

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