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

/**
 * Holds Customer subscription details. Clients can display available products to unregistered customers by explicitly
 * passing subscription details.
 */
@Fluent
public final class CustomerSubscriptionDetails {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomerSubscriptionDetails.class);

    /*
     * List of registered feature flags for subscription
     */
    @JsonProperty(value = "registeredFeatures")
    private List<CustomerSubscriptionRegisteredFeatures> registeredFeatures;

    /*
     * Location placement Id of a subscription
     */
    @JsonProperty(value = "locationPlacementId")
    private String locationPlacementId;

    /*
     * Quota ID of a subscription
     */
    @JsonProperty(value = "quotaId", required = true)
    private String quotaId;

    /**
     * Get the registeredFeatures property: List of registered feature flags for subscription.
     *
     * @return the registeredFeatures value.
     */
    public List<CustomerSubscriptionRegisteredFeatures> registeredFeatures() {
        return this.registeredFeatures;
    }

    /**
     * Set the registeredFeatures property: List of registered feature flags for subscription.
     *
     * @param registeredFeatures the registeredFeatures value to set.
     * @return the CustomerSubscriptionDetails object itself.
     */
    public CustomerSubscriptionDetails withRegisteredFeatures(
        List<CustomerSubscriptionRegisteredFeatures> registeredFeatures) {
        this.registeredFeatures = registeredFeatures;
        return this;
    }

    /**
     * Get the locationPlacementId property: Location placement Id of a subscription.
     *
     * @return the locationPlacementId value.
     */
    public String locationPlacementId() {
        return this.locationPlacementId;
    }

    /**
     * Set the locationPlacementId property: Location placement Id of a subscription.
     *
     * @param locationPlacementId the locationPlacementId value to set.
     * @return the CustomerSubscriptionDetails object itself.
     */
    public CustomerSubscriptionDetails withLocationPlacementId(String locationPlacementId) {
        this.locationPlacementId = locationPlacementId;
        return this;
    }

    /**
     * Get the quotaId property: Quota ID of a subscription.
     *
     * @return the quotaId value.
     */
    public String quotaId() {
        return this.quotaId;
    }

    /**
     * Set the quotaId property: Quota ID of a subscription.
     *
     * @param quotaId the quotaId value to set.
     * @return the CustomerSubscriptionDetails object itself.
     */
    public CustomerSubscriptionDetails withQuotaId(String quotaId) {
        this.quotaId = quotaId;
        return this;
    }

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