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

package com.azure.resourcemanager.recoveryservicessiterecovery.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** The properties of a monitoring event. */
@Fluent
public final class EventProperties {
    /*
     * The Id of the monitoring event.
     */
    @JsonProperty(value = "eventCode")
    private String eventCode;

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

    /*
     * The type of the event. for example: VM Health, Server Health, Job Failure etc.
     */
    @JsonProperty(value = "eventType")
    private String eventType;

    /*
     * The friendly name of the source of the event on which it is raised (for example, VM, VMM etc).
     */
    @JsonProperty(value = "affectedObjectFriendlyName")
    private String affectedObjectFriendlyName;

    /*
     * The affected object correlationId for the event.
     */
    @JsonProperty(value = "affectedObjectCorrelationId")
    private String affectedObjectCorrelationId;

    /*
     * The severity of the event.
     */
    @JsonProperty(value = "severity")
    private String severity;

    /*
     * The time of occurrence of the event.
     */
    @JsonProperty(value = "timeOfOccurrence")
    private OffsetDateTime timeOfOccurrence;

    /*
     * The ARM ID of the fabric.
     */
    @JsonProperty(value = "fabricId")
    private String fabricId;

    /*
     * The provider specific settings.
     */
    @JsonProperty(value = "providerSpecificDetails")
    private EventProviderSpecificDetails providerSpecificDetails;

    /*
     * The event specific settings.
     */
    @JsonProperty(value = "eventSpecificDetails")
    private EventSpecificDetails eventSpecificDetails;

    /*
     * The list of errors / warnings capturing details associated with the issue(s).
     */
    @JsonProperty(value = "healthErrors")
    private List<HealthError> healthErrors;

    /** Creates an instance of EventProperties class. */
    public EventProperties() {
    }

    /**
     * Get the eventCode property: The Id of the monitoring event.
     *
     * @return the eventCode value.
     */
    public String eventCode() {
        return this.eventCode;
    }

    /**
     * Set the eventCode property: The Id of the monitoring event.
     *
     * @param eventCode the eventCode value to set.
     * @return the EventProperties object itself.
     */
    public EventProperties withEventCode(String eventCode) {
        this.eventCode = eventCode;
        return this;
    }

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

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

    /**
     * Get the eventType property: The type of the event. for example: VM Health, Server Health, Job Failure etc.
     *
     * @return the eventType value.
     */
    public String eventType() {
        return this.eventType;
    }

    /**
     * Set the eventType property: The type of the event. for example: VM Health, Server Health, Job Failure etc.
     *
     * @param eventType the eventType value to set.
     * @return the EventProperties object itself.
     */
    public EventProperties withEventType(String eventType) {
        this.eventType = eventType;
        return this;
    }

    /**
     * Get the affectedObjectFriendlyName property: The friendly name of the source of the event on which it is raised
     * (for example, VM, VMM etc).
     *
     * @return the affectedObjectFriendlyName value.
     */
    public String affectedObjectFriendlyName() {
        return this.affectedObjectFriendlyName;
    }

    /**
     * Set the affectedObjectFriendlyName property: The friendly name of the source of the event on which it is raised
     * (for example, VM, VMM etc).
     *
     * @param affectedObjectFriendlyName the affectedObjectFriendlyName value to set.
     * @return the EventProperties object itself.
     */
    public EventProperties withAffectedObjectFriendlyName(String affectedObjectFriendlyName) {
        this.affectedObjectFriendlyName = affectedObjectFriendlyName;
        return this;
    }

    /**
     * Get the affectedObjectCorrelationId property: The affected object correlationId for the event.
     *
     * @return the affectedObjectCorrelationId value.
     */
    public String affectedObjectCorrelationId() {
        return this.affectedObjectCorrelationId;
    }

    /**
     * Set the affectedObjectCorrelationId property: The affected object correlationId for the event.
     *
     * @param affectedObjectCorrelationId the affectedObjectCorrelationId value to set.
     * @return the EventProperties object itself.
     */
    public EventProperties withAffectedObjectCorrelationId(String affectedObjectCorrelationId) {
        this.affectedObjectCorrelationId = affectedObjectCorrelationId;
        return this;
    }

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

    /**
     * Set the severity property: The severity of the event.
     *
     * @param severity the severity value to set.
     * @return the EventProperties object itself.
     */
    public EventProperties withSeverity(String severity) {
        this.severity = severity;
        return this;
    }

    /**
     * Get the timeOfOccurrence property: The time of occurrence of the event.
     *
     * @return the timeOfOccurrence value.
     */
    public OffsetDateTime timeOfOccurrence() {
        return this.timeOfOccurrence;
    }

    /**
     * Set the timeOfOccurrence property: The time of occurrence of the event.
     *
     * @param timeOfOccurrence the timeOfOccurrence value to set.
     * @return the EventProperties object itself.
     */
    public EventProperties withTimeOfOccurrence(OffsetDateTime timeOfOccurrence) {
        this.timeOfOccurrence = timeOfOccurrence;
        return this;
    }

    /**
     * Get the fabricId property: The ARM ID of the fabric.
     *
     * @return the fabricId value.
     */
    public String fabricId() {
        return this.fabricId;
    }

    /**
     * Set the fabricId property: The ARM ID of the fabric.
     *
     * @param fabricId the fabricId value to set.
     * @return the EventProperties object itself.
     */
    public EventProperties withFabricId(String fabricId) {
        this.fabricId = fabricId;
        return this;
    }

    /**
     * Get the providerSpecificDetails property: The provider specific settings.
     *
     * @return the providerSpecificDetails value.
     */
    public EventProviderSpecificDetails providerSpecificDetails() {
        return this.providerSpecificDetails;
    }

    /**
     * Set the providerSpecificDetails property: The provider specific settings.
     *
     * @param providerSpecificDetails the providerSpecificDetails value to set.
     * @return the EventProperties object itself.
     */
    public EventProperties withProviderSpecificDetails(EventProviderSpecificDetails providerSpecificDetails) {
        this.providerSpecificDetails = providerSpecificDetails;
        return this;
    }

    /**
     * Get the eventSpecificDetails property: The event specific settings.
     *
     * @return the eventSpecificDetails value.
     */
    public EventSpecificDetails eventSpecificDetails() {
        return this.eventSpecificDetails;
    }

    /**
     * Set the eventSpecificDetails property: The event specific settings.
     *
     * @param eventSpecificDetails the eventSpecificDetails value to set.
     * @return the EventProperties object itself.
     */
    public EventProperties withEventSpecificDetails(EventSpecificDetails eventSpecificDetails) {
        this.eventSpecificDetails = eventSpecificDetails;
        return this;
    }

    /**
     * Get the healthErrors property: The list of errors / warnings capturing details associated with the issue(s).
     *
     * @return the healthErrors value.
     */
    public List<HealthError> healthErrors() {
        return this.healthErrors;
    }

    /**
     * Set the healthErrors property: The list of errors / warnings capturing details associated with the issue(s).
     *
     * @param healthErrors the healthErrors value to set.
     * @return the EventProperties object itself.
     */
    public EventProperties withHealthErrors(List<HealthError> healthErrors) {
        this.healthErrors = healthErrors;
        return this;
    }

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