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

package com.azure.resourcemanager.videoanalyzer.models;

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

/** The IoT Hub details. */
@Fluent
public final class IotHub {
    /*
     * The IoT Hub resource identifier.
     */
    @JsonProperty(value = "id", required = true)
    private String id;

    /*
     * The IoT Hub identity.
     */
    @JsonProperty(value = "identity", required = true)
    private ResourceIdentity identity;

    /*
     * The current status of the Iot Hub mapping.
     */
    @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
    private String status;

    /**
     * Get the id property: The IoT Hub resource identifier.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Set the id property: The IoT Hub resource identifier.
     *
     * @param id the id value to set.
     * @return the IotHub object itself.
     */
    public IotHub withId(String id) {
        this.id = id;
        return this;
    }

    /**
     * Get the identity property: The IoT Hub identity.
     *
     * @return the identity value.
     */
    public ResourceIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: The IoT Hub identity.
     *
     * @param identity the identity value to set.
     * @return the IotHub object itself.
     */
    public IotHub withIdentity(ResourceIdentity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the status property: The current status of the Iot Hub mapping.
     *
     * @return the status value.
     */
    public String status() {
        return this.status;
    }

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

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