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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.security.models.AdditionalWorkspacesProperties;
import com.azure.resourcemanager.security.models.DataSource;
import com.azure.resourcemanager.security.models.ExportData;
import com.azure.resourcemanager.security.models.RecommendationConfigurationProperties;
import com.azure.resourcemanager.security.models.SecuritySolutionStatus;
import com.azure.resourcemanager.security.models.UnmaskedIpLoggingStatus;
import com.azure.resourcemanager.security.models.UserDefinedResourcesProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Security Solution setting data. */
@Fluent
public final class IoTSecuritySolutionProperties {
    /*
     * Workspace resource ID
     */
    @JsonProperty(value = "workspace")
    private String workspace;

    /*
     * Resource display name.
     */
    @JsonProperty(value = "displayName", required = true)
    private String displayName;

    /*
     * Status of the IoT Security solution.
     */
    @JsonProperty(value = "status")
    private SecuritySolutionStatus status;

    /*
     * List of additional options for exporting to workspace data.
     */
    @JsonProperty(value = "export")
    private List<ExportData> export;

    /*
     * Disabled data sources. Disabling these data sources compromises the system.
     */
    @JsonProperty(value = "disabledDataSources")
    private List<DataSource> disabledDataSources;

    /*
     * IoT Hub resource IDs
     */
    @JsonProperty(value = "iotHubs", required = true)
    private List<String> iotHubs;

    /*
     * Properties of the IoT Security solution's user defined resources.
     */
    @JsonProperty(value = "userDefinedResources")
    private UserDefinedResourcesProperties userDefinedResources;

    /*
     * List of resources that were automatically discovered as relevant to the security solution.
     */
    @JsonProperty(value = "autoDiscoveredResources", access = JsonProperty.Access.WRITE_ONLY)
    private List<String> autoDiscoveredResources;

    /*
     * List of the configuration status for each recommendation type.
     */
    @JsonProperty(value = "recommendationsConfiguration")
    private List<RecommendationConfigurationProperties> recommendationsConfiguration;

    /*
     * Unmasked IP address logging status
     */
    @JsonProperty(value = "unmaskedIpLoggingStatus")
    private UnmaskedIpLoggingStatus unmaskedIpLoggingStatus;

    /*
     * List of additional workspaces
     */
    @JsonProperty(value = "additionalWorkspaces")
    private List<AdditionalWorkspacesProperties> additionalWorkspaces;

    /** Creates an instance of IoTSecuritySolutionProperties class. */
    public IoTSecuritySolutionProperties() {
    }

    /**
     * Get the workspace property: Workspace resource ID.
     *
     * @return the workspace value.
     */
    public String workspace() {
        return this.workspace;
    }

    /**
     * Set the workspace property: Workspace resource ID.
     *
     * @param workspace the workspace value to set.
     * @return the IoTSecuritySolutionProperties object itself.
     */
    public IoTSecuritySolutionProperties withWorkspace(String workspace) {
        this.workspace = workspace;
        return this;
    }

    /**
     * Get the displayName property: Resource display name.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: Resource display name.
     *
     * @param displayName the displayName value to set.
     * @return the IoTSecuritySolutionProperties object itself.
     */
    public IoTSecuritySolutionProperties withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the status property: Status of the IoT Security solution.
     *
     * @return the status value.
     */
    public SecuritySolutionStatus status() {
        return this.status;
    }

    /**
     * Set the status property: Status of the IoT Security solution.
     *
     * @param status the status value to set.
     * @return the IoTSecuritySolutionProperties object itself.
     */
    public IoTSecuritySolutionProperties withStatus(SecuritySolutionStatus status) {
        this.status = status;
        return this;
    }

    /**
     * Get the export property: List of additional options for exporting to workspace data.
     *
     * @return the export value.
     */
    public List<ExportData> export() {
        return this.export;
    }

    /**
     * Set the export property: List of additional options for exporting to workspace data.
     *
     * @param export the export value to set.
     * @return the IoTSecuritySolutionProperties object itself.
     */
    public IoTSecuritySolutionProperties withExport(List<ExportData> export) {
        this.export = export;
        return this;
    }

    /**
     * Get the disabledDataSources property: Disabled data sources. Disabling these data sources compromises the system.
     *
     * @return the disabledDataSources value.
     */
    public List<DataSource> disabledDataSources() {
        return this.disabledDataSources;
    }

    /**
     * Set the disabledDataSources property: Disabled data sources. Disabling these data sources compromises the system.
     *
     * @param disabledDataSources the disabledDataSources value to set.
     * @return the IoTSecuritySolutionProperties object itself.
     */
    public IoTSecuritySolutionProperties withDisabledDataSources(List<DataSource> disabledDataSources) {
        this.disabledDataSources = disabledDataSources;
        return this;
    }

    /**
     * Get the iotHubs property: IoT Hub resource IDs.
     *
     * @return the iotHubs value.
     */
    public List<String> iotHubs() {
        return this.iotHubs;
    }

    /**
     * Set the iotHubs property: IoT Hub resource IDs.
     *
     * @param iotHubs the iotHubs value to set.
     * @return the IoTSecuritySolutionProperties object itself.
     */
    public IoTSecuritySolutionProperties withIotHubs(List<String> iotHubs) {
        this.iotHubs = iotHubs;
        return this;
    }

    /**
     * Get the userDefinedResources property: Properties of the IoT Security solution's user defined resources.
     *
     * @return the userDefinedResources value.
     */
    public UserDefinedResourcesProperties userDefinedResources() {
        return this.userDefinedResources;
    }

    /**
     * Set the userDefinedResources property: Properties of the IoT Security solution's user defined resources.
     *
     * @param userDefinedResources the userDefinedResources value to set.
     * @return the IoTSecuritySolutionProperties object itself.
     */
    public IoTSecuritySolutionProperties withUserDefinedResources(UserDefinedResourcesProperties userDefinedResources) {
        this.userDefinedResources = userDefinedResources;
        return this;
    }

    /**
     * Get the autoDiscoveredResources property: List of resources that were automatically discovered as relevant to the
     * security solution.
     *
     * @return the autoDiscoveredResources value.
     */
    public List<String> autoDiscoveredResources() {
        return this.autoDiscoveredResources;
    }

    /**
     * Get the recommendationsConfiguration property: List of the configuration status for each recommendation type.
     *
     * @return the recommendationsConfiguration value.
     */
    public List<RecommendationConfigurationProperties> recommendationsConfiguration() {
        return this.recommendationsConfiguration;
    }

    /**
     * Set the recommendationsConfiguration property: List of the configuration status for each recommendation type.
     *
     * @param recommendationsConfiguration the recommendationsConfiguration value to set.
     * @return the IoTSecuritySolutionProperties object itself.
     */
    public IoTSecuritySolutionProperties withRecommendationsConfiguration(
        List<RecommendationConfigurationProperties> recommendationsConfiguration) {
        this.recommendationsConfiguration = recommendationsConfiguration;
        return this;
    }

    /**
     * Get the unmaskedIpLoggingStatus property: Unmasked IP address logging status.
     *
     * @return the unmaskedIpLoggingStatus value.
     */
    public UnmaskedIpLoggingStatus unmaskedIpLoggingStatus() {
        return this.unmaskedIpLoggingStatus;
    }

    /**
     * Set the unmaskedIpLoggingStatus property: Unmasked IP address logging status.
     *
     * @param unmaskedIpLoggingStatus the unmaskedIpLoggingStatus value to set.
     * @return the IoTSecuritySolutionProperties object itself.
     */
    public IoTSecuritySolutionProperties withUnmaskedIpLoggingStatus(UnmaskedIpLoggingStatus unmaskedIpLoggingStatus) {
        this.unmaskedIpLoggingStatus = unmaskedIpLoggingStatus;
        return this;
    }

    /**
     * Get the additionalWorkspaces property: List of additional workspaces.
     *
     * @return the additionalWorkspaces value.
     */
    public List<AdditionalWorkspacesProperties> additionalWorkspaces() {
        return this.additionalWorkspaces;
    }

    /**
     * Set the additionalWorkspaces property: List of additional workspaces.
     *
     * @param additionalWorkspaces the additionalWorkspaces value to set.
     * @return the IoTSecuritySolutionProperties object itself.
     */
    public IoTSecuritySolutionProperties withAdditionalWorkspaces(
        List<AdditionalWorkspacesProperties> additionalWorkspaces) {
        this.additionalWorkspaces = additionalWorkspaces;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (displayName() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property displayName in model IoTSecuritySolutionProperties"));
        }
        if (iotHubs() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property iotHubs in model IoTSecuritySolutionProperties"));
        }
        if (userDefinedResources() != null) {
            userDefinedResources().validate();
        }
        if (recommendationsConfiguration() != null) {
            recommendationsConfiguration().forEach(e -> e.validate());
        }
        if (additionalWorkspaces() != null) {
            additionalWorkspaces().forEach(e -> e.validate());
        }
    }

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