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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.alertsmanagement.models.Severity;
import com.azure.resourcemanager.alertsmanagement.models.SmartGroupAggregatedProperty;
import com.azure.resourcemanager.alertsmanagement.models.State;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** Properties of smart group. */
@Fluent
public final class SmartGroupProperties {
    /*
     * Total number of alerts in smart group
     */
    @JsonProperty(value = "alertsCount")
    private Long alertsCount;

    /*
     * Smart group state
     */
    @JsonProperty(value = "smartGroupState", access = JsonProperty.Access.WRITE_ONLY)
    private State smartGroupState;

    /*
     * Severity of smart group is the highest(Sev0 >... > Sev4) severity of all the alerts in the group.
     */
    @JsonProperty(value = "severity", access = JsonProperty.Access.WRITE_ONLY)
    private Severity severity;

    /*
     * Creation time of smart group. Date-Time in ISO-8601 format.
     */
    @JsonProperty(value = "startDateTime", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime startDateTime;

    /*
     * Last updated time of smart group. Date-Time in ISO-8601 format.
     */
    @JsonProperty(value = "lastModifiedDateTime", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime lastModifiedDateTime;

    /*
     * Last modified by user name.
     */
    @JsonProperty(value = "lastModifiedUserName", access = JsonProperty.Access.WRITE_ONLY)
    private String lastModifiedUsername;

    /*
     * Summary of target resources in the smart group
     */
    @JsonProperty(value = "resources")
    private List<SmartGroupAggregatedProperty> resources;

    /*
     * Summary of target resource types in the smart group
     */
    @JsonProperty(value = "resourceTypes")
    private List<SmartGroupAggregatedProperty> resourceTypes;

    /*
     * Summary of target resource groups in the smart group
     */
    @JsonProperty(value = "resourceGroups")
    private List<SmartGroupAggregatedProperty> resourceGroups;

    /*
     * Summary of monitorServices in the smart group
     */
    @JsonProperty(value = "monitorServices")
    private List<SmartGroupAggregatedProperty> monitorServices;

    /*
     * Summary of monitorConditions in the smart group
     */
    @JsonProperty(value = "monitorConditions")
    private List<SmartGroupAggregatedProperty> monitorConditions;

    /*
     * Summary of alertStates in the smart group
     */
    @JsonProperty(value = "alertStates")
    private List<SmartGroupAggregatedProperty> alertStates;

    /*
     * Summary of alertSeverities in the smart group
     */
    @JsonProperty(value = "alertSeverities")
    private List<SmartGroupAggregatedProperty> alertSeverities;

    /*
     * The URI to fetch the next page of alerts. Call ListNext() with this URI to fetch the next page alerts.
     */
    @JsonProperty(value = "nextLink")
    private String nextLink;

    /**
     * Get the alertsCount property: Total number of alerts in smart group.
     *
     * @return the alertsCount value.
     */
    public Long alertsCount() {
        return this.alertsCount;
    }

    /**
     * Set the alertsCount property: Total number of alerts in smart group.
     *
     * @param alertsCount the alertsCount value to set.
     * @return the SmartGroupProperties object itself.
     */
    public SmartGroupProperties withAlertsCount(Long alertsCount) {
        this.alertsCount = alertsCount;
        return this;
    }

    /**
     * Get the smartGroupState property: Smart group state.
     *
     * @return the smartGroupState value.
     */
    public State smartGroupState() {
        return this.smartGroupState;
    }

    /**
     * Get the severity property: Severity of smart group is the highest(Sev0 &gt;... &gt; Sev4) severity of all the
     * alerts in the group.
     *
     * @return the severity value.
     */
    public Severity severity() {
        return this.severity;
    }

    /**
     * Get the startDateTime property: Creation time of smart group. Date-Time in ISO-8601 format.
     *
     * @return the startDateTime value.
     */
    public OffsetDateTime startDateTime() {
        return this.startDateTime;
    }

    /**
     * Get the lastModifiedDateTime property: Last updated time of smart group. Date-Time in ISO-8601 format.
     *
     * @return the lastModifiedDateTime value.
     */
    public OffsetDateTime lastModifiedDateTime() {
        return this.lastModifiedDateTime;
    }

    /**
     * Get the lastModifiedUsername property: Last modified by user name.
     *
     * @return the lastModifiedUsername value.
     */
    public String lastModifiedUsername() {
        return this.lastModifiedUsername;
    }

    /**
     * Get the resources property: Summary of target resources in the smart group.
     *
     * @return the resources value.
     */
    public List<SmartGroupAggregatedProperty> resources() {
        return this.resources;
    }

    /**
     * Set the resources property: Summary of target resources in the smart group.
     *
     * @param resources the resources value to set.
     * @return the SmartGroupProperties object itself.
     */
    public SmartGroupProperties withResources(List<SmartGroupAggregatedProperty> resources) {
        this.resources = resources;
        return this;
    }

    /**
     * Get the resourceTypes property: Summary of target resource types in the smart group.
     *
     * @return the resourceTypes value.
     */
    public List<SmartGroupAggregatedProperty> resourceTypes() {
        return this.resourceTypes;
    }

    /**
     * Set the resourceTypes property: Summary of target resource types in the smart group.
     *
     * @param resourceTypes the resourceTypes value to set.
     * @return the SmartGroupProperties object itself.
     */
    public SmartGroupProperties withResourceTypes(List<SmartGroupAggregatedProperty> resourceTypes) {
        this.resourceTypes = resourceTypes;
        return this;
    }

    /**
     * Get the resourceGroups property: Summary of target resource groups in the smart group.
     *
     * @return the resourceGroups value.
     */
    public List<SmartGroupAggregatedProperty> resourceGroups() {
        return this.resourceGroups;
    }

    /**
     * Set the resourceGroups property: Summary of target resource groups in the smart group.
     *
     * @param resourceGroups the resourceGroups value to set.
     * @return the SmartGroupProperties object itself.
     */
    public SmartGroupProperties withResourceGroups(List<SmartGroupAggregatedProperty> resourceGroups) {
        this.resourceGroups = resourceGroups;
        return this;
    }

    /**
     * Get the monitorServices property: Summary of monitorServices in the smart group.
     *
     * @return the monitorServices value.
     */
    public List<SmartGroupAggregatedProperty> monitorServices() {
        return this.monitorServices;
    }

    /**
     * Set the monitorServices property: Summary of monitorServices in the smart group.
     *
     * @param monitorServices the monitorServices value to set.
     * @return the SmartGroupProperties object itself.
     */
    public SmartGroupProperties withMonitorServices(List<SmartGroupAggregatedProperty> monitorServices) {
        this.monitorServices = monitorServices;
        return this;
    }

    /**
     * Get the monitorConditions property: Summary of monitorConditions in the smart group.
     *
     * @return the monitorConditions value.
     */
    public List<SmartGroupAggregatedProperty> monitorConditions() {
        return this.monitorConditions;
    }

    /**
     * Set the monitorConditions property: Summary of monitorConditions in the smart group.
     *
     * @param monitorConditions the monitorConditions value to set.
     * @return the SmartGroupProperties object itself.
     */
    public SmartGroupProperties withMonitorConditions(List<SmartGroupAggregatedProperty> monitorConditions) {
        this.monitorConditions = monitorConditions;
        return this;
    }

    /**
     * Get the alertStates property: Summary of alertStates in the smart group.
     *
     * @return the alertStates value.
     */
    public List<SmartGroupAggregatedProperty> alertStates() {
        return this.alertStates;
    }

    /**
     * Set the alertStates property: Summary of alertStates in the smart group.
     *
     * @param alertStates the alertStates value to set.
     * @return the SmartGroupProperties object itself.
     */
    public SmartGroupProperties withAlertStates(List<SmartGroupAggregatedProperty> alertStates) {
        this.alertStates = alertStates;
        return this;
    }

    /**
     * Get the alertSeverities property: Summary of alertSeverities in the smart group.
     *
     * @return the alertSeverities value.
     */
    public List<SmartGroupAggregatedProperty> alertSeverities() {
        return this.alertSeverities;
    }

    /**
     * Set the alertSeverities property: Summary of alertSeverities in the smart group.
     *
     * @param alertSeverities the alertSeverities value to set.
     * @return the SmartGroupProperties object itself.
     */
    public SmartGroupProperties withAlertSeverities(List<SmartGroupAggregatedProperty> alertSeverities) {
        this.alertSeverities = alertSeverities;
        return this;
    }

    /**
     * Get the nextLink property: The URI to fetch the next page of alerts. Call ListNext() with this URI to fetch the
     * next page alerts.
     *
     * @return the nextLink value.
     */
    public String nextLink() {
        return this.nextLink;
    }

    /**
     * Set the nextLink property: The URI to fetch the next page of alerts. Call ListNext() with this URI to fetch the
     * next page alerts.
     *
     * @param nextLink the nextLink value to set.
     * @return the SmartGroupProperties object itself.
     */
    public SmartGroupProperties withNextLink(String nextLink) {
        this.nextLink = nextLink;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (resources() != null) {
            resources().forEach(e -> e.validate());
        }
        if (resourceTypes() != null) {
            resourceTypes().forEach(e -> e.validate());
        }
        if (resourceGroups() != null) {
            resourceGroups().forEach(e -> e.validate());
        }
        if (monitorServices() != null) {
            monitorServices().forEach(e -> e.validate());
        }
        if (monitorConditions() != null) {
            monitorConditions().forEach(e -> e.validate());
        }
        if (alertStates() != null) {
            alertStates().forEach(e -> e.validate());
        }
        if (alertSeverities() != null) {
            alertSeverities().forEach(e -> e.validate());
        }
    }
}
