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

package com.azure.resourcemanager.edgeorder.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Configuration filters. */
@Fluent
public final class ConfigurationFilters {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationFilters.class);

    /*
     * Product hierarchy information
     */
    @JsonProperty(value = "hierarchyInformation", required = true)
    private HierarchyInformation hierarchyInformation;

    /*
     * Filters specific to product
     */
    @JsonProperty(value = "filterableProperty")
    private List<FilterableProperty> filterableProperty;

    /**
     * Get the hierarchyInformation property: Product hierarchy information.
     *
     * @return the hierarchyInformation value.
     */
    public HierarchyInformation hierarchyInformation() {
        return this.hierarchyInformation;
    }

    /**
     * Set the hierarchyInformation property: Product hierarchy information.
     *
     * @param hierarchyInformation the hierarchyInformation value to set.
     * @return the ConfigurationFilters object itself.
     */
    public ConfigurationFilters withHierarchyInformation(HierarchyInformation hierarchyInformation) {
        this.hierarchyInformation = hierarchyInformation;
        return this;
    }

    /**
     * Get the filterableProperty property: Filters specific to product.
     *
     * @return the filterableProperty value.
     */
    public List<FilterableProperty> filterableProperty() {
        return this.filterableProperty;
    }

    /**
     * Set the filterableProperty property: Filters specific to product.
     *
     * @param filterableProperty the filterableProperty value to set.
     * @return the ConfigurationFilters object itself.
     */
    public ConfigurationFilters withFilterableProperty(List<FilterableProperty> filterableProperty) {
        this.filterableProperty = filterableProperty;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (hierarchyInformation() == null) {
            throw logger
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property hierarchyInformation in model ConfigurationFilters"));
        } else {
            hierarchyInformation().validate();
        }
        if (filterableProperty() != null) {
            filterableProperty().forEach(e -> e.validate());
        }
    }
}
