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

package com.azure.resourcemanager.apimanagement.models;

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

/** Endpoints accessed for a common purpose that the Api Management Service requires outbound network access to. */
@Fluent
public final class OutboundEnvironmentEndpoint {
    /*
     * The type of service accessed by the Api Management Service, e.g., Azure
     * Storage, Azure SQL Database, and Azure Active Directory.
     */
    @JsonProperty(value = "category")
    private String category;

    /*
     * The endpoints that the Api Management Service reaches the service at.
     */
    @JsonProperty(value = "endpoints")
    private List<EndpointDependency> endpoints;

    /**
     * Get the category property: The type of service accessed by the Api Management Service, e.g., Azure Storage, Azure
     * SQL Database, and Azure Active Directory.
     *
     * @return the category value.
     */
    public String category() {
        return this.category;
    }

    /**
     * Set the category property: The type of service accessed by the Api Management Service, e.g., Azure Storage, Azure
     * SQL Database, and Azure Active Directory.
     *
     * @param category the category value to set.
     * @return the OutboundEnvironmentEndpoint object itself.
     */
    public OutboundEnvironmentEndpoint withCategory(String category) {
        this.category = category;
        return this;
    }

    /**
     * Get the endpoints property: The endpoints that the Api Management Service reaches the service at.
     *
     * @return the endpoints value.
     */
    public List<EndpointDependency> endpoints() {
        return this.endpoints;
    }

    /**
     * Set the endpoints property: The endpoints that the Api Management Service reaches the service at.
     *
     * @param endpoints the endpoints value to set.
     * @return the OutboundEnvironmentEndpoint object itself.
     */
    public OutboundEnvironmentEndpoint withEndpoints(List<EndpointDependency> endpoints) {
        this.endpoints = endpoints;
        return this;
    }

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