// 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;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.time.OffsetDateTime;

/** Represents security alert timeline item. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind")
@JsonTypeName("SecurityAlert")
@Fluent
public final class SecurityAlertTimelineItem extends EntityTimelineItem {
    /*
     * The alert azure resource id.
     */
    @JsonProperty(value = "azureResourceId", required = true)
    private String azureResourceId;

    /*
     * The alert product name.
     */
    @JsonProperty(value = "productName")
    private String productName;

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

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

    /*
     * The alert severity.
     */
    @JsonProperty(value = "severity", required = true)
    private AlertSeverity severity;

    /*
     * The alert end time.
     */
    @JsonProperty(value = "endTimeUtc", required = true)
    private OffsetDateTime endTimeUtc;

    /*
     * The alert start time.
     */
    @JsonProperty(value = "startTimeUtc", required = true)
    private OffsetDateTime startTimeUtc;

    /*
     * The alert generated time.
     */
    @JsonProperty(value = "timeGenerated", required = true)
    private OffsetDateTime timeGenerated;

    /*
     * The name of the alert type.
     */
    @JsonProperty(value = "alertType", required = true)
    private String alertType;

    /**
     * Get the azureResourceId property: The alert azure resource id.
     *
     * @return the azureResourceId value.
     */
    public String azureResourceId() {
        return this.azureResourceId;
    }

    /**
     * Set the azureResourceId property: The alert azure resource id.
     *
     * @param azureResourceId the azureResourceId value to set.
     * @return the SecurityAlertTimelineItem object itself.
     */
    public SecurityAlertTimelineItem withAzureResourceId(String azureResourceId) {
        this.azureResourceId = azureResourceId;
        return this;
    }

    /**
     * Get the productName property: The alert product name.
     *
     * @return the productName value.
     */
    public String productName() {
        return this.productName;
    }

    /**
     * Set the productName property: The alert product name.
     *
     * @param productName the productName value to set.
     * @return the SecurityAlertTimelineItem object itself.
     */
    public SecurityAlertTimelineItem withProductName(String productName) {
        this.productName = productName;
        return this;
    }

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

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

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

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

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

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

    /**
     * Get the endTimeUtc property: The alert end time.
     *
     * @return the endTimeUtc value.
     */
    public OffsetDateTime endTimeUtc() {
        return this.endTimeUtc;
    }

    /**
     * Set the endTimeUtc property: The alert end time.
     *
     * @param endTimeUtc the endTimeUtc value to set.
     * @return the SecurityAlertTimelineItem object itself.
     */
    public SecurityAlertTimelineItem withEndTimeUtc(OffsetDateTime endTimeUtc) {
        this.endTimeUtc = endTimeUtc;
        return this;
    }

    /**
     * Get the startTimeUtc property: The alert start time.
     *
     * @return the startTimeUtc value.
     */
    public OffsetDateTime startTimeUtc() {
        return this.startTimeUtc;
    }

    /**
     * Set the startTimeUtc property: The alert start time.
     *
     * @param startTimeUtc the startTimeUtc value to set.
     * @return the SecurityAlertTimelineItem object itself.
     */
    public SecurityAlertTimelineItem withStartTimeUtc(OffsetDateTime startTimeUtc) {
        this.startTimeUtc = startTimeUtc;
        return this;
    }

    /**
     * Get the timeGenerated property: The alert generated time.
     *
     * @return the timeGenerated value.
     */
    public OffsetDateTime timeGenerated() {
        return this.timeGenerated;
    }

    /**
     * Set the timeGenerated property: The alert generated time.
     *
     * @param timeGenerated the timeGenerated value to set.
     * @return the SecurityAlertTimelineItem object itself.
     */
    public SecurityAlertTimelineItem withTimeGenerated(OffsetDateTime timeGenerated) {
        this.timeGenerated = timeGenerated;
        return this;
    }

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

    /**
     * Set the alertType property: The name of the alert type.
     *
     * @param alertType the alertType value to set.
     * @return the SecurityAlertTimelineItem object itself.
     */
    public SecurityAlertTimelineItem withAlertType(String alertType) {
        this.alertType = alertType;
        return this;
    }

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

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