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

/** Represents product details. */
@Fluent
public final class ProductDetails {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(ProductDetails.class);

    /*
     * Display details of the product
     */
    @JsonProperty(value = "displayInfo")
    private DisplayInfo displayInfo;

    /*
     * Hierarchy of the product which uniquely identifies the product
     */
    @JsonProperty(value = "hierarchyInformation", required = true)
    private HierarchyInformation hierarchyInformation;

    /*
     * Quantity of the product
     */
    @JsonProperty(value = "count", access = JsonProperty.Access.WRITE_ONLY)
    private Integer count;

    /*
     * Double encryption status of the configuration. Read-only field.
     */
    @JsonProperty(value = "productDoubleEncryptionStatus", access = JsonProperty.Access.WRITE_ONLY)
    private DoubleEncryptionStatus productDoubleEncryptionStatus;

    /*
     * list of device details
     */
    @JsonProperty(value = "deviceDetails", access = JsonProperty.Access.WRITE_ONLY)
    private List<DeviceDetails> deviceDetails;

    /**
     * Get the displayInfo property: Display details of the product.
     *
     * @return the displayInfo value.
     */
    public DisplayInfo displayInfo() {
        return this.displayInfo;
    }

    /**
     * Set the displayInfo property: Display details of the product.
     *
     * @param displayInfo the displayInfo value to set.
     * @return the ProductDetails object itself.
     */
    public ProductDetails withDisplayInfo(DisplayInfo displayInfo) {
        this.displayInfo = displayInfo;
        return this;
    }

    /**
     * Get the hierarchyInformation property: Hierarchy of the product which uniquely identifies the product.
     *
     * @return the hierarchyInformation value.
     */
    public HierarchyInformation hierarchyInformation() {
        return this.hierarchyInformation;
    }

    /**
     * Set the hierarchyInformation property: Hierarchy of the product which uniquely identifies the product.
     *
     * @param hierarchyInformation the hierarchyInformation value to set.
     * @return the ProductDetails object itself.
     */
    public ProductDetails withHierarchyInformation(HierarchyInformation hierarchyInformation) {
        this.hierarchyInformation = hierarchyInformation;
        return this;
    }

    /**
     * Get the count property: Quantity of the product.
     *
     * @return the count value.
     */
    public Integer count() {
        return this.count;
    }

    /**
     * Get the productDoubleEncryptionStatus property: Double encryption status of the configuration. Read-only field.
     *
     * @return the productDoubleEncryptionStatus value.
     */
    public DoubleEncryptionStatus productDoubleEncryptionStatus() {
        return this.productDoubleEncryptionStatus;
    }

    /**
     * Get the deviceDetails property: list of device details.
     *
     * @return the deviceDetails value.
     */
    public List<DeviceDetails> deviceDetails() {
        return this.deviceDetails;
    }

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