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

package com.azure.resourcemanager.resourcehealth.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.resourcehealth.models.StatusActiveEvent;
import com.azure.resourcemanager.resourcehealth.models.StatusBanner;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** On-going emerging issue from azure status. */
@Fluent
public final class EmergingIssue {
    /*
     * Timestamp for when last time refreshed for ongoing emerging issue.
     */
    @JsonProperty(value = "refreshTimestamp")
    private OffsetDateTime refreshTimestamp;

    /*
     * The list of emerging issues of banner type.
     */
    @JsonProperty(value = "statusBanners")
    private List<StatusBanner> statusBanners;

    /*
     * The list of emerging issues of active event type.
     */
    @JsonProperty(value = "statusActiveEvents")
    private List<StatusActiveEvent> statusActiveEvents;

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

    /**
     * Get the refreshTimestamp property: Timestamp for when last time refreshed for ongoing emerging issue.
     *
     * @return the refreshTimestamp value.
     */
    public OffsetDateTime refreshTimestamp() {
        return this.refreshTimestamp;
    }

    /**
     * Set the refreshTimestamp property: Timestamp for when last time refreshed for ongoing emerging issue.
     *
     * @param refreshTimestamp the refreshTimestamp value to set.
     * @return the EmergingIssue object itself.
     */
    public EmergingIssue withRefreshTimestamp(OffsetDateTime refreshTimestamp) {
        this.refreshTimestamp = refreshTimestamp;
        return this;
    }

    /**
     * Get the statusBanners property: The list of emerging issues of banner type.
     *
     * @return the statusBanners value.
     */
    public List<StatusBanner> statusBanners() {
        return this.statusBanners;
    }

    /**
     * Set the statusBanners property: The list of emerging issues of banner type.
     *
     * @param statusBanners the statusBanners value to set.
     * @return the EmergingIssue object itself.
     */
    public EmergingIssue withStatusBanners(List<StatusBanner> statusBanners) {
        this.statusBanners = statusBanners;
        return this;
    }

    /**
     * Get the statusActiveEvents property: The list of emerging issues of active event type.
     *
     * @return the statusActiveEvents value.
     */
    public List<StatusActiveEvent> statusActiveEvents() {
        return this.statusActiveEvents;
    }

    /**
     * Set the statusActiveEvents property: The list of emerging issues of active event type.
     *
     * @param statusActiveEvents the statusActiveEvents value to set.
     * @return the EmergingIssue object itself.
     */
    public EmergingIssue withStatusActiveEvents(List<StatusActiveEvent> statusActiveEvents) {
        this.statusActiveEvents = statusActiveEvents;
        return this;
    }

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