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

package com.azure.resourcemanager.resourcemover.models;

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

/** Defines the load balancer resource settings. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "resourceType")
@JsonTypeName("Microsoft.Network/loadBalancers")
@Fluent
public final class LoadBalancerResourceSettings extends ResourceSettings {
    /*
     * Gets or sets load balancer sku (Basic/Standard).
     */
    @JsonProperty(value = "sku")
    private String sku;

    /*
     * Gets or sets the frontend IP configurations of the load balancer.
     */
    @JsonProperty(value = "frontendIPConfigurations")
    private List<LBFrontendIpConfigurationResourceSettings> frontendIpConfigurations;

    /*
     * Gets or sets the backend address pools of the load balancer.
     */
    @JsonProperty(value = "backendAddressPools")
    private List<LBBackendAddressPoolResourceSettings> backendAddressPools;

    /*
     * Gets or sets the csv list of zones common for all frontend IP configurations. Note this is given
     * precedence only if frontend IP configurations settings are not present.
     */
    @JsonProperty(value = "zones")
    private String zones;

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

    /**
     * Get the sku property: Gets or sets load balancer sku (Basic/Standard).
     *
     * @return the sku value.
     */
    public String sku() {
        return this.sku;
    }

    /**
     * Set the sku property: Gets or sets load balancer sku (Basic/Standard).
     *
     * @param sku the sku value to set.
     * @return the LoadBalancerResourceSettings object itself.
     */
    public LoadBalancerResourceSettings withSku(String sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the frontendIpConfigurations property: Gets or sets the frontend IP configurations of the load balancer.
     *
     * @return the frontendIpConfigurations value.
     */
    public List<LBFrontendIpConfigurationResourceSettings> frontendIpConfigurations() {
        return this.frontendIpConfigurations;
    }

    /**
     * Set the frontendIpConfigurations property: Gets or sets the frontend IP configurations of the load balancer.
     *
     * @param frontendIpConfigurations the frontendIpConfigurations value to set.
     * @return the LoadBalancerResourceSettings object itself.
     */
    public LoadBalancerResourceSettings withFrontendIpConfigurations(
        List<LBFrontendIpConfigurationResourceSettings> frontendIpConfigurations) {
        this.frontendIpConfigurations = frontendIpConfigurations;
        return this;
    }

    /**
     * Get the backendAddressPools property: Gets or sets the backend address pools of the load balancer.
     *
     * @return the backendAddressPools value.
     */
    public List<LBBackendAddressPoolResourceSettings> backendAddressPools() {
        return this.backendAddressPools;
    }

    /**
     * Set the backendAddressPools property: Gets or sets the backend address pools of the load balancer.
     *
     * @param backendAddressPools the backendAddressPools value to set.
     * @return the LoadBalancerResourceSettings object itself.
     */
    public LoadBalancerResourceSettings withBackendAddressPools(
        List<LBBackendAddressPoolResourceSettings> backendAddressPools) {
        this.backendAddressPools = backendAddressPools;
        return this;
    }

    /**
     * Get the zones property: Gets or sets the csv list of zones common for all frontend IP configurations. Note this
     * is given precedence only if frontend IP configurations settings are not present.
     *
     * @return the zones value.
     */
    public String zones() {
        return this.zones;
    }

    /**
     * Set the zones property: Gets or sets the csv list of zones common for all frontend IP configurations. Note this
     * is given precedence only if frontend IP configurations settings are not present.
     *
     * @param zones the zones value to set.
     * @return the LoadBalancerResourceSettings object itself.
     */
    public LoadBalancerResourceSettings withZones(String zones) {
        this.zones = zones;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public LoadBalancerResourceSettings withTargetResourceName(String targetResourceName) {
        super.withTargetResourceName(targetResourceName);
        return this;
    }

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