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

package com.azure.resourcemanager.securityinsights.models;

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

/** Represents a supported source subtype configuration under a source signal in Fusion detection. */
@Fluent
public final class FusionSourceSubTypeSetting {
    /*
     * Determines whether this source subtype under source signal is enabled or disabled in Fusion detection.
     */
    @JsonProperty(value = "enabled", required = true)
    private boolean enabled;

    /*
     * The Name of the source subtype under a given source signal in Fusion detection. Refer to Fusion alert rule
     * template for supported values.
     */
    @JsonProperty(value = "sourceSubTypeName", required = true)
    private String sourceSubTypeName;

    /*
     * The display name of source subtype under a source signal consumed in Fusion detection.
     */
    @JsonProperty(value = "sourceSubTypeDisplayName", access = JsonProperty.Access.WRITE_ONLY)
    private String sourceSubTypeDisplayName;

    /*
     * Severity configuration for a source subtype consumed in fusion detection.
     */
    @JsonProperty(value = "severityFilters", required = true)
    private FusionSubTypeSeverityFilter severityFilters;

    /**
     * Get the enabled property: Determines whether this source subtype under source signal is enabled or disabled in
     * Fusion detection.
     *
     * @return the enabled value.
     */
    public boolean enabled() {
        return this.enabled;
    }

    /**
     * Set the enabled property: Determines whether this source subtype under source signal is enabled or disabled in
     * Fusion detection.
     *
     * @param enabled the enabled value to set.
     * @return the FusionSourceSubTypeSetting object itself.
     */
    public FusionSourceSubTypeSetting withEnabled(boolean enabled) {
        this.enabled = enabled;
        return this;
    }

    /**
     * Get the sourceSubTypeName property: The Name of the source subtype under a given source signal in Fusion
     * detection. Refer to Fusion alert rule template for supported values.
     *
     * @return the sourceSubTypeName value.
     */
    public String sourceSubTypeName() {
        return this.sourceSubTypeName;
    }

    /**
     * Set the sourceSubTypeName property: The Name of the source subtype under a given source signal in Fusion
     * detection. Refer to Fusion alert rule template for supported values.
     *
     * @param sourceSubTypeName the sourceSubTypeName value to set.
     * @return the FusionSourceSubTypeSetting object itself.
     */
    public FusionSourceSubTypeSetting withSourceSubTypeName(String sourceSubTypeName) {
        this.sourceSubTypeName = sourceSubTypeName;
        return this;
    }

    /**
     * Get the sourceSubTypeDisplayName property: The display name of source subtype under a source signal consumed in
     * Fusion detection.
     *
     * @return the sourceSubTypeDisplayName value.
     */
    public String sourceSubTypeDisplayName() {
        return this.sourceSubTypeDisplayName;
    }

    /**
     * Get the severityFilters property: Severity configuration for a source subtype consumed in fusion detection.
     *
     * @return the severityFilters value.
     */
    public FusionSubTypeSeverityFilter severityFilters() {
        return this.severityFilters;
    }

    /**
     * Set the severityFilters property: Severity configuration for a source subtype consumed in fusion detection.
     *
     * @param severityFilters the severityFilters value to set.
     * @return the FusionSourceSubTypeSetting object itself.
     */
    public FusionSourceSubTypeSetting withSeverityFilters(FusionSubTypeSeverityFilter severityFilters) {
        this.severityFilters = severityFilters;
        return this;
    }

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

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