// 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.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** The filters for showing the product families. */
@Fluent
public final class ProductFamiliesRequest {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(ProductFamiliesRequest.class);

    /*
     * Dictionary of filterable properties on product family.
     */
    @JsonProperty(value = "filterableProperties", required = true)
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, List<FilterableProperty>> filterableProperties;

    /*
     * Customer subscription properties. Clients can display available products
     * to unregistered customers by explicitly passing subscription details
     */
    @JsonProperty(value = "customerSubscriptionDetails")
    private CustomerSubscriptionDetails customerSubscriptionDetails;

    /**
     * Get the filterableProperties property: Dictionary of filterable properties on product family.
     *
     * @return the filterableProperties value.
     */
    public Map<String, List<FilterableProperty>> filterableProperties() {
        return this.filterableProperties;
    }

    /**
     * Set the filterableProperties property: Dictionary of filterable properties on product family.
     *
     * @param filterableProperties the filterableProperties value to set.
     * @return the ProductFamiliesRequest object itself.
     */
    public ProductFamiliesRequest withFilterableProperties(Map<String, List<FilterableProperty>> filterableProperties) {
        this.filterableProperties = filterableProperties;
        return this;
    }

    /**
     * Get the customerSubscriptionDetails property: Customer subscription properties. Clients can display available
     * products to unregistered customers by explicitly passing subscription details.
     *
     * @return the customerSubscriptionDetails value.
     */
    public CustomerSubscriptionDetails customerSubscriptionDetails() {
        return this.customerSubscriptionDetails;
    }

    /**
     * Set the customerSubscriptionDetails property: Customer subscription properties. Clients can display available
     * products to unregistered customers by explicitly passing subscription details.
     *
     * @param customerSubscriptionDetails the customerSubscriptionDetails value to set.
     * @return the ProductFamiliesRequest object itself.
     */
    public ProductFamiliesRequest withCustomerSubscriptionDetails(
        CustomerSubscriptionDetails customerSubscriptionDetails) {
        this.customerSubscriptionDetails = customerSubscriptionDetails;
        return this;
    }

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