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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.deviceupdate.models.DiagnosticStorageProperties;
import com.azure.resourcemanager.deviceupdate.models.IotHubSettings;
import com.azure.resourcemanager.deviceupdate.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Device Update instance properties. */
@Fluent
public final class InstanceProperties {
    /*
     * Provisioning state.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

    /*
     * Parent Device Update Account name which Instance belongs to.
     */
    @JsonProperty(value = "accountName", access = JsonProperty.Access.WRITE_ONLY)
    private String accountName;

    /*
     * List of IoT Hubs associated with the account.
     */
    @JsonProperty(value = "iotHubs")
    private List<IotHubSettings> iotHubs;

    /*
     * Enables or Disables the diagnostic logs collection
     */
    @JsonProperty(value = "enableDiagnostics")
    private Boolean enableDiagnostics;

    /*
     * Customer-initiated diagnostic log collection storage properties
     */
    @JsonProperty(value = "diagnosticStorageProperties")
    private DiagnosticStorageProperties diagnosticStorageProperties;

    /**
     * Get the provisioningState property: Provisioning state.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the accountName property: Parent Device Update Account name which Instance belongs to.
     *
     * @return the accountName value.
     */
    public String accountName() {
        return this.accountName;
    }

    /**
     * Get the iotHubs property: List of IoT Hubs associated with the account.
     *
     * @return the iotHubs value.
     */
    public List<IotHubSettings> iotHubs() {
        return this.iotHubs;
    }

    /**
     * Set the iotHubs property: List of IoT Hubs associated with the account.
     *
     * @param iotHubs the iotHubs value to set.
     * @return the InstanceProperties object itself.
     */
    public InstanceProperties withIotHubs(List<IotHubSettings> iotHubs) {
        this.iotHubs = iotHubs;
        return this;
    }

    /**
     * Get the enableDiagnostics property: Enables or Disables the diagnostic logs collection.
     *
     * @return the enableDiagnostics value.
     */
    public Boolean enableDiagnostics() {
        return this.enableDiagnostics;
    }

    /**
     * Set the enableDiagnostics property: Enables or Disables the diagnostic logs collection.
     *
     * @param enableDiagnostics the enableDiagnostics value to set.
     * @return the InstanceProperties object itself.
     */
    public InstanceProperties withEnableDiagnostics(Boolean enableDiagnostics) {
        this.enableDiagnostics = enableDiagnostics;
        return this;
    }

    /**
     * Get the diagnosticStorageProperties property: Customer-initiated diagnostic log collection storage properties.
     *
     * @return the diagnosticStorageProperties value.
     */
    public DiagnosticStorageProperties diagnosticStorageProperties() {
        return this.diagnosticStorageProperties;
    }

    /**
     * Set the diagnosticStorageProperties property: Customer-initiated diagnostic log collection storage properties.
     *
     * @param diagnosticStorageProperties the diagnosticStorageProperties value to set.
     * @return the InstanceProperties object itself.
     */
    public InstanceProperties withDiagnosticStorageProperties(DiagnosticStorageProperties diagnosticStorageProperties) {
        this.diagnosticStorageProperties = diagnosticStorageProperties;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (iotHubs() != null) {
            iotHubs().forEach(e -> e.validate());
        }
        if (diagnosticStorageProperties() != null) {
            diagnosticStorageProperties().validate();
        }
    }
}
