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

/** MicrosoftSecurityIncidentCreation rule property bag. */
@Fluent
public final class MicrosoftSecurityIncidentCreationAlertRuleProperties
    extends MicrosoftSecurityIncidentCreationAlertRuleCommonProperties {
    /*
     * The Name of the alert rule template used to create this rule.
     */
    @JsonProperty(value = "alertRuleTemplateName")
    private String alertRuleTemplateName;

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

    /*
     * The display name for alerts created by this alert rule.
     */
    @JsonProperty(value = "displayName", required = true)
    private String displayName;

    /*
     * Determines whether this alert rule is enabled or disabled.
     */
    @JsonProperty(value = "enabled", required = true)
    private boolean enabled;

    /*
     * The last time that this alert has been modified.
     */
    @JsonProperty(value = "lastModifiedUtc", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime lastModifiedUtc;

    /**
     * Get the alertRuleTemplateName property: The Name of the alert rule template used to create this rule.
     *
     * @return the alertRuleTemplateName value.
     */
    public String alertRuleTemplateName() {
        return this.alertRuleTemplateName;
    }

    /**
     * Set the alertRuleTemplateName property: The Name of the alert rule template used to create this rule.
     *
     * @param alertRuleTemplateName the alertRuleTemplateName value to set.
     * @return the MicrosoftSecurityIncidentCreationAlertRuleProperties object itself.
     */
    public MicrosoftSecurityIncidentCreationAlertRuleProperties withAlertRuleTemplateName(
        String alertRuleTemplateName) {
        this.alertRuleTemplateName = alertRuleTemplateName;
        return this;
    }

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

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

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

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

    /**
     * Get the enabled property: Determines whether this alert rule is enabled or disabled.
     *
     * @return the enabled value.
     */
    public boolean enabled() {
        return this.enabled;
    }

    /**
     * Set the enabled property: Determines whether this alert rule is enabled or disabled.
     *
     * @param enabled the enabled value to set.
     * @return the MicrosoftSecurityIncidentCreationAlertRuleProperties object itself.
     */
    public MicrosoftSecurityIncidentCreationAlertRuleProperties withEnabled(boolean enabled) {
        this.enabled = enabled;
        return this;
    }

    /**
     * Get the lastModifiedUtc property: The last time that this alert has been modified.
     *
     * @return the lastModifiedUtc value.
     */
    public OffsetDateTime lastModifiedUtc() {
        return this.lastModifiedUtc;
    }

    /** {@inheritDoc} */
    @Override
    public MicrosoftSecurityIncidentCreationAlertRuleProperties withDisplayNamesFilter(
        List<String> displayNamesFilter) {
        super.withDisplayNamesFilter(displayNamesFilter);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public MicrosoftSecurityIncidentCreationAlertRuleProperties withDisplayNamesExcludeFilter(
        List<String> displayNamesExcludeFilter) {
        super.withDisplayNamesExcludeFilter(displayNamesExcludeFilter);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public MicrosoftSecurityIncidentCreationAlertRuleProperties withProductFilter(
        MicrosoftSecurityProductName productFilter) {
        super.withProductFilter(productFilter);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public MicrosoftSecurityIncidentCreationAlertRuleProperties withSeveritiesFilter(
        List<AlertSeverity> severitiesFilter) {
        super.withSeveritiesFilter(severitiesFilter);
        return this;
    }

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

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