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

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

import com.azure.core.annotation.Immutable;
import com.azure.resourcemanager.workloads.models.ApplicationServerVmDetails;
import com.azure.resourcemanager.workloads.models.LoadBalancerDetails;
import com.azure.resourcemanager.workloads.models.SapHealthState;
import com.azure.resourcemanager.workloads.models.SapVirtualInstanceError;
import com.azure.resourcemanager.workloads.models.SapVirtualInstanceProvisioningState;
import com.azure.resourcemanager.workloads.models.SapVirtualInstanceStatus;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Defines the SAP Application Server instance properties. */
@Immutable
public final class SapApplicationServerProperties {
    /*
     * Application server Instance Number.
     */
    @JsonProperty(value = "instanceNo", access = JsonProperty.Access.WRITE_ONLY)
    private String instanceNo;

    /*
     * Application server Subnet.
     */
    @JsonProperty(value = "subnet", access = JsonProperty.Access.WRITE_ONLY)
    private String subnet;

    /*
     * Application server instance SAP hostname.
     */
    @JsonProperty(value = "hostname", access = JsonProperty.Access.WRITE_ONLY)
    private String hostname;

    /*
     * Application server instance SAP Kernel Version.
     */
    @JsonProperty(value = "kernelVersion", access = JsonProperty.Access.WRITE_ONLY)
    private String kernelVersion;

    /*
     * Application server instance SAP Kernel Patch level.
     */
    @JsonProperty(value = "kernelPatch", access = JsonProperty.Access.WRITE_ONLY)
    private String kernelPatch;

    /*
     * Application server instance SAP IP Address.
     */
    @JsonProperty(value = "ipAddress", access = JsonProperty.Access.WRITE_ONLY)
    private String ipAddress;

    /*
     * Application server instance gateway Port.
     */
    @JsonProperty(value = "gatewayPort", access = JsonProperty.Access.WRITE_ONLY)
    private Long gatewayPort;

    /*
     * Application server instance ICM HTTP Port.
     */
    @JsonProperty(value = "icmHttpPort", access = JsonProperty.Access.WRITE_ONLY)
    private Long icmHttpPort;

    /*
     * Application server instance ICM HTTPS Port.
     */
    @JsonProperty(value = "icmHttpsPort", access = JsonProperty.Access.WRITE_ONLY)
    private Long icmHttpsPort;

    /*
     * The Load Balancer details such as LoadBalancer ID attached to Application Server Virtual Machines
     */
    @JsonProperty(value = "loadBalancerDetails", access = JsonProperty.Access.WRITE_ONLY)
    private LoadBalancerDetails loadBalancerDetails;

    /*
     * The list of virtual machines.
     */
    @JsonProperty(value = "vmDetails", access = JsonProperty.Access.WRITE_ONLY)
    private List<ApplicationServerVmDetails> vmDetails;

    /*
     * Defines the SAP Instance status.
     */
    @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
    private SapVirtualInstanceStatus status;

    /*
     * Defines the health of SAP Instances.
     */
    @JsonProperty(value = "health", access = JsonProperty.Access.WRITE_ONLY)
    private SapHealthState health;

    /*
     * Defines the provisioning states.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private SapVirtualInstanceProvisioningState provisioningState;

    /*
     * Defines the Application Instance errors.
     */
    @JsonProperty(value = "errors", access = JsonProperty.Access.WRITE_ONLY)
    private SapVirtualInstanceError errors;

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

    /**
     * Get the instanceNo property: Application server Instance Number.
     *
     * @return the instanceNo value.
     */
    public String instanceNo() {
        return this.instanceNo;
    }

    /**
     * Get the subnet property: Application server Subnet.
     *
     * @return the subnet value.
     */
    public String subnet() {
        return this.subnet;
    }

    /**
     * Get the hostname property: Application server instance SAP hostname.
     *
     * @return the hostname value.
     */
    public String hostname() {
        return this.hostname;
    }

    /**
     * Get the kernelVersion property: Application server instance SAP Kernel Version.
     *
     * @return the kernelVersion value.
     */
    public String kernelVersion() {
        return this.kernelVersion;
    }

    /**
     * Get the kernelPatch property: Application server instance SAP Kernel Patch level.
     *
     * @return the kernelPatch value.
     */
    public String kernelPatch() {
        return this.kernelPatch;
    }

    /**
     * Get the ipAddress property: Application server instance SAP IP Address.
     *
     * @return the ipAddress value.
     */
    public String ipAddress() {
        return this.ipAddress;
    }

    /**
     * Get the gatewayPort property: Application server instance gateway Port.
     *
     * @return the gatewayPort value.
     */
    public Long gatewayPort() {
        return this.gatewayPort;
    }

    /**
     * Get the icmHttpPort property: Application server instance ICM HTTP Port.
     *
     * @return the icmHttpPort value.
     */
    public Long icmHttpPort() {
        return this.icmHttpPort;
    }

    /**
     * Get the icmHttpsPort property: Application server instance ICM HTTPS Port.
     *
     * @return the icmHttpsPort value.
     */
    public Long icmHttpsPort() {
        return this.icmHttpsPort;
    }

    /**
     * Get the loadBalancerDetails property: The Load Balancer details such as LoadBalancer ID attached to Application
     * Server Virtual Machines.
     *
     * @return the loadBalancerDetails value.
     */
    public LoadBalancerDetails loadBalancerDetails() {
        return this.loadBalancerDetails;
    }

    /**
     * Get the vmDetails property: The list of virtual machines.
     *
     * @return the vmDetails value.
     */
    public List<ApplicationServerVmDetails> vmDetails() {
        return this.vmDetails;
    }

    /**
     * Get the status property: Defines the SAP Instance status.
     *
     * @return the status value.
     */
    public SapVirtualInstanceStatus status() {
        return this.status;
    }

    /**
     * Get the health property: Defines the health of SAP Instances.
     *
     * @return the health value.
     */
    public SapHealthState health() {
        return this.health;
    }

    /**
     * Get the provisioningState property: Defines the provisioning states.
     *
     * @return the provisioningState value.
     */
    public SapVirtualInstanceProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the errors property: Defines the Application Instance errors.
     *
     * @return the errors value.
     */
    public SapVirtualInstanceError errors() {
        return this.errors;
    }

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