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

package com.azure.resourcemanager.hardwaresecuritymodules.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.hardwaresecuritymodules.models.JsonWebKeyType;
import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkProfile;
import com.azure.resourcemanager.hardwaresecuritymodules.models.Sku;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Resource information with extended details. */
@Fluent
public final class DedicatedHsmInner extends Resource {
    /*
     * Metadata pertaining to creation and last modification of the resource
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /*
     * Properties of the dedicated HSM
     */
    @JsonProperty(value = "properties", required = true)
    private DedicatedHsmProperties innerProperties = new DedicatedHsmProperties();

    /*
     * SKU details
     */
    @JsonProperty(value = "sku")
    private Sku sku;

    /*
     * The Dedicated Hsm zones.
     */
    @JsonProperty(value = "zones")
    private List<String> zones;

    /**
     * Get the systemData property: Metadata pertaining to creation and last modification of the resource.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the innerProperties property: Properties of the dedicated HSM.
     *
     * @return the innerProperties value.
     */
    private DedicatedHsmProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the sku property: SKU details.
     *
     * @return the sku value.
     */
    public Sku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: SKU details.
     *
     * @param sku the sku value to set.
     * @return the DedicatedHsmInner object itself.
     */
    public DedicatedHsmInner withSku(Sku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the zones property: The Dedicated Hsm zones.
     *
     * @return the zones value.
     */
    public List<String> zones() {
        return this.zones;
    }

    /**
     * Set the zones property: The Dedicated Hsm zones.
     *
     * @param zones the zones value to set.
     * @return the DedicatedHsmInner object itself.
     */
    public DedicatedHsmInner withZones(List<String> zones) {
        this.zones = zones;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public DedicatedHsmInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public DedicatedHsmInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the networkProfile property: Specifies the network interfaces of the dedicated hsm.
     *
     * @return the networkProfile value.
     */
    public NetworkProfile networkProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().networkProfile();
    }

    /**
     * Set the networkProfile property: Specifies the network interfaces of the dedicated hsm.
     *
     * @param networkProfile the networkProfile value to set.
     * @return the DedicatedHsmInner object itself.
     */
    public DedicatedHsmInner withNetworkProfile(NetworkProfile networkProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DedicatedHsmProperties();
        }
        this.innerProperties().withNetworkProfile(networkProfile);
        return this;
    }

    /**
     * Get the managementNetworkProfile property: Specifies the management network interfaces of the dedicated hsm.
     *
     * @return the managementNetworkProfile value.
     */
    public NetworkProfile managementNetworkProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().managementNetworkProfile();
    }

    /**
     * Set the managementNetworkProfile property: Specifies the management network interfaces of the dedicated hsm.
     *
     * @param managementNetworkProfile the managementNetworkProfile value to set.
     * @return the DedicatedHsmInner object itself.
     */
    public DedicatedHsmInner withManagementNetworkProfile(NetworkProfile managementNetworkProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DedicatedHsmProperties();
        }
        this.innerProperties().withManagementNetworkProfile(managementNetworkProfile);
        return this;
    }

    /**
     * Get the stampId property: This field will be used when RP does not support Availability zones.
     *
     * @return the stampId value.
     */
    public String stampId() {
        return this.innerProperties() == null ? null : this.innerProperties().stampId();
    }

    /**
     * Set the stampId property: This field will be used when RP does not support Availability zones.
     *
     * @param stampId the stampId value to set.
     * @return the DedicatedHsmInner object itself.
     */
    public DedicatedHsmInner withStampId(String stampId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DedicatedHsmProperties();
        }
        this.innerProperties().withStampId(stampId);
        return this;
    }

    /**
     * Get the statusMessage property: Resource Status Message.
     *
     * @return the statusMessage value.
     */
    public String statusMessage() {
        return this.innerProperties() == null ? null : this.innerProperties().statusMessage();
    }

    /**
     * Get the provisioningState property: Provisioning state.
     *
     * @return the provisioningState value.
     */
    public JsonWebKeyType provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

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

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