// 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.models;

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

/** Object of the emerging issue impact on services and regions. */
@Fluent
public final class EmergingIssueImpact {
    /*
     * The impacted service id.
     */
    @JsonProperty(value = "id")
    private String id;

    /*
     * The impacted service name.
     */
    @JsonProperty(value = "name")
    private String name;

    /*
     * The list of impacted regions for corresponding emerging issues.
     */
    @JsonProperty(value = "regions")
    private List<ImpactedRegion> regions;

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

    /**
     * Get the id property: The impacted service id.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Set the id property: The impacted service id.
     *
     * @param id the id value to set.
     * @return the EmergingIssueImpact object itself.
     */
    public EmergingIssueImpact withId(String id) {
        this.id = id;
        return this;
    }

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

    /**
     * Set the name property: The impacted service name.
     *
     * @param name the name value to set.
     * @return the EmergingIssueImpact object itself.
     */
    public EmergingIssueImpact withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the regions property: The list of impacted regions for corresponding emerging issues.
     *
     * @return the regions value.
     */
    public List<ImpactedRegion> regions() {
        return this.regions;
    }

    /**
     * Set the regions property: The list of impacted regions for corresponding emerging issues.
     *
     * @param regions the regions value to set.
     * @return the EmergingIssueImpact object itself.
     */
    public EmergingIssueImpact withRegions(List<ImpactedRegion> regions) {
        this.regions = regions;
        return this;
    }

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