// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateDataSource;
import com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateWithMitreProperties;
import com.azure.resourcemanager.securityinsights.models.AlertSeverity;
import com.azure.resourcemanager.securityinsights.models.AttackTactic;
import com.azure.resourcemanager.securityinsights.models.TemplateStatus;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Threat Intelligence alert rule template properties. */
@Fluent
public final class ThreatIntelligenceAlertRuleTemplateProperties extends AlertRuleTemplateWithMitreProperties {
    /*
     * The severity for alerts created by this alert rule.
     */
    @JsonProperty(value = "severity", required = true)
    private AlertSeverity severity;

    /**
     * Get the severity property: The severity for alerts created by this alert rule.
     *
     * @return the severity value.
     */
    public AlertSeverity severity() {
        return this.severity;
    }

    /**
     * Set the severity property: The severity for alerts created by this alert rule.
     *
     * @param severity the severity value to set.
     * @return the ThreatIntelligenceAlertRuleTemplateProperties object itself.
     */
    public ThreatIntelligenceAlertRuleTemplateProperties withSeverity(AlertSeverity severity) {
        this.severity = severity;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ThreatIntelligenceAlertRuleTemplateProperties withTactics(List<AttackTactic> tactics) {
        super.withTactics(tactics);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ThreatIntelligenceAlertRuleTemplateProperties withTechniques(List<String> techniques) {
        super.withTechniques(techniques);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ThreatIntelligenceAlertRuleTemplateProperties withAlertRulesCreatedByTemplateCount(
        Integer alertRulesCreatedByTemplateCount) {
        super.withAlertRulesCreatedByTemplateCount(alertRulesCreatedByTemplateCount);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ThreatIntelligenceAlertRuleTemplateProperties withDescription(String description) {
        super.withDescription(description);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ThreatIntelligenceAlertRuleTemplateProperties withDisplayName(String displayName) {
        super.withDisplayName(displayName);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ThreatIntelligenceAlertRuleTemplateProperties withRequiredDataConnectors(
        List<AlertRuleTemplateDataSource> requiredDataConnectors) {
        super.withRequiredDataConnectors(requiredDataConnectors);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ThreatIntelligenceAlertRuleTemplateProperties withStatus(TemplateStatus status) {
        super.withStatus(status);
        return this;
    }

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

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