// 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.resourcemanager.securityinsights.models.AlertRuleTemplateDataSource;
import com.azure.resourcemanager.securityinsights.models.AlertSeverity;
import com.azure.resourcemanager.securityinsights.models.AttackTactic;
import com.azure.resourcemanager.securityinsights.models.FusionTemplateSourceSetting;
import com.azure.resourcemanager.securityinsights.models.TemplateStatus;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** Fusion alert rule template properties. */
@Fluent
public final class FusionAlertRuleTemplateProperties {
    /*
     * the number of alert rules that were created by this template
     */
    @JsonProperty(value = "alertRulesCreatedByTemplateCount")
    private Integer alertRulesCreatedByTemplateCount;

    /*
     * The time that this alert rule template has been added.
     */
    @JsonProperty(value = "createdDateUTC", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime createdDateUtc;

    /*
     * The time that this alert rule template was last updated.
     */
    @JsonProperty(value = "lastUpdatedDateUTC", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime lastUpdatedDateUtc;

    /*
     * The description of the alert rule template.
     */
    @JsonProperty(value = "description")
    private String description;

    /*
     * The display name for alert rule template.
     */
    @JsonProperty(value = "displayName")
    private String displayName;

    /*
     * The required data connectors for this template
     */
    @JsonProperty(value = "requiredDataConnectors")
    private List<AlertRuleTemplateDataSource> requiredDataConnectors;

    /*
     * The alert rule template status.
     */
    @JsonProperty(value = "status")
    private TemplateStatus status;

    /*
     * The severity for alerts created by this alert rule.
     */
    @JsonProperty(value = "severity")
    private AlertSeverity severity;

    /*
     * The tactics of the alert rule template
     */
    @JsonProperty(value = "tactics")
    private List<AttackTactic> tactics;

    /*
     * The techniques of the alert rule
     */
    @JsonProperty(value = "techniques")
    private List<String> techniques;

    /*
     * All supported source signal configurations consumed in fusion detection.
     */
    @JsonProperty(value = "sourceSettings")
    private List<FusionTemplateSourceSetting> sourceSettings;

    /**
     * Get the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template.
     *
     * @return the alertRulesCreatedByTemplateCount value.
     */
    public Integer alertRulesCreatedByTemplateCount() {
        return this.alertRulesCreatedByTemplateCount;
    }

    /**
     * Set the alertRulesCreatedByTemplateCount property: the number of alert rules that were created by this template.
     *
     * @param alertRulesCreatedByTemplateCount the alertRulesCreatedByTemplateCount value to set.
     * @return the FusionAlertRuleTemplateProperties object itself.
     */
    public FusionAlertRuleTemplateProperties withAlertRulesCreatedByTemplateCount(
        Integer alertRulesCreatedByTemplateCount) {
        this.alertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount;
        return this;
    }

    /**
     * Get the createdDateUtc property: The time that this alert rule template has been added.
     *
     * @return the createdDateUtc value.
     */
    public OffsetDateTime createdDateUtc() {
        return this.createdDateUtc;
    }

    /**
     * Get the lastUpdatedDateUtc property: The time that this alert rule template was last updated.
     *
     * @return the lastUpdatedDateUtc value.
     */
    public OffsetDateTime lastUpdatedDateUtc() {
        return this.lastUpdatedDateUtc;
    }

    /**
     * Get the description property: The description of the alert rule template.
     *
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: The description of the alert rule template.
     *
     * @param description the description value to set.
     * @return the FusionAlertRuleTemplateProperties object itself.
     */
    public FusionAlertRuleTemplateProperties withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the displayName property: The display name for alert rule template.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: The display name for alert rule template.
     *
     * @param displayName the displayName value to set.
     * @return the FusionAlertRuleTemplateProperties object itself.
     */
    public FusionAlertRuleTemplateProperties withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the requiredDataConnectors property: The required data connectors for this template.
     *
     * @return the requiredDataConnectors value.
     */
    public List<AlertRuleTemplateDataSource> requiredDataConnectors() {
        return this.requiredDataConnectors;
    }

    /**
     * Set the requiredDataConnectors property: The required data connectors for this template.
     *
     * @param requiredDataConnectors the requiredDataConnectors value to set.
     * @return the FusionAlertRuleTemplateProperties object itself.
     */
    public FusionAlertRuleTemplateProperties withRequiredDataConnectors(
        List<AlertRuleTemplateDataSource> requiredDataConnectors) {
        this.requiredDataConnectors = requiredDataConnectors;
        return this;
    }

    /**
     * Get the status property: The alert rule template status.
     *
     * @return the status value.
     */
    public TemplateStatus status() {
        return this.status;
    }

    /**
     * Set the status property: The alert rule template status.
     *
     * @param status the status value to set.
     * @return the FusionAlertRuleTemplateProperties object itself.
     */
    public FusionAlertRuleTemplateProperties withStatus(TemplateStatus status) {
        this.status = status;
        return this;
    }

    /**
     * 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 FusionAlertRuleTemplateProperties object itself.
     */
    public FusionAlertRuleTemplateProperties withSeverity(AlertSeverity severity) {
        this.severity = severity;
        return this;
    }

    /**
     * Get the tactics property: The tactics of the alert rule template.
     *
     * @return the tactics value.
     */
    public List<AttackTactic> tactics() {
        return this.tactics;
    }

    /**
     * Set the tactics property: The tactics of the alert rule template.
     *
     * @param tactics the tactics value to set.
     * @return the FusionAlertRuleTemplateProperties object itself.
     */
    public FusionAlertRuleTemplateProperties withTactics(List<AttackTactic> tactics) {
        this.tactics = tactics;
        return this;
    }

    /**
     * Get the techniques property: The techniques of the alert rule.
     *
     * @return the techniques value.
     */
    public List<String> techniques() {
        return this.techniques;
    }

    /**
     * Set the techniques property: The techniques of the alert rule.
     *
     * @param techniques the techniques value to set.
     * @return the FusionAlertRuleTemplateProperties object itself.
     */
    public FusionAlertRuleTemplateProperties withTechniques(List<String> techniques) {
        this.techniques = techniques;
        return this;
    }

    /**
     * Get the sourceSettings property: All supported source signal configurations consumed in fusion detection.
     *
     * @return the sourceSettings value.
     */
    public List<FusionTemplateSourceSetting> sourceSettings() {
        return this.sourceSettings;
    }

    /**
     * Set the sourceSettings property: All supported source signal configurations consumed in fusion detection.
     *
     * @param sourceSettings the sourceSettings value to set.
     * @return the FusionAlertRuleTemplateProperties object itself.
     */
    public FusionAlertRuleTemplateProperties withSourceSettings(List<FusionTemplateSourceSetting> sourceSettings) {
        this.sourceSettings = sourceSettings;
        return this;
    }

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