// 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.Fluent;
import com.azure.resourcemanager.workloads.models.CentralServerVmDetails;
import com.azure.resourcemanager.workloads.models.EnqueueReplicationServerProperties;
import com.azure.resourcemanager.workloads.models.EnqueueServerProperties;
import com.azure.resourcemanager.workloads.models.GatewayServerProperties;
import com.azure.resourcemanager.workloads.models.LoadBalancerDetails;
import com.azure.resourcemanager.workloads.models.MessageServerProperties;
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 Central Services Instance properties. */
@Fluent
public final class SapCentralServerProperties {
    /*
     * The central services instance number.
     */
    @JsonProperty(value = "instanceNo", access = JsonProperty.Access.WRITE_ONLY)
    private String instanceNo;

    /*
     * The central services instance subnet.
     */
    @JsonProperty(value = "subnet", access = JsonProperty.Access.WRITE_ONLY)
    private String subnet;

    /*
     * Defines the SAP Message Server properties.
     */
    @JsonProperty(value = "messageServerProperties")
    private MessageServerProperties messageServerProperties;

    /*
     * Defines the SAP Enqueue Server properties.
     */
    @JsonProperty(value = "enqueueServerProperties")
    private EnqueueServerProperties enqueueServerProperties;

    /*
     * Defines the SAP Gateway Server properties.
     */
    @JsonProperty(value = "gatewayServerProperties")
    private GatewayServerProperties gatewayServerProperties;

    /*
     * Defines the SAP Enqueue Replication Server (ERS) properties.
     */
    @JsonProperty(value = "enqueueReplicationServerProperties")
    private EnqueueReplicationServerProperties enqueueReplicationServerProperties;

    /*
     * The central services instance Kernel Version.
     */
    @JsonProperty(value = "kernelVersion", access = JsonProperty.Access.WRITE_ONLY)
    private String kernelVersion;

    /*
     * The central services instance Kernel Patch level.
     */
    @JsonProperty(value = "kernelPatch", access = JsonProperty.Access.WRITE_ONLY)
    private String kernelPatch;

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

    /*
     * The list of virtual machines corresponding to the Central Services instance.
     */
    @JsonProperty(value = "vmDetails", access = JsonProperty.Access.WRITE_ONLY)
    private List<CentralServerVmDetails> 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 errors related to SAP Central Services Instance resource.
     */
    @JsonProperty(value = "errors", access = JsonProperty.Access.WRITE_ONLY)
    private SapVirtualInstanceError errors;

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

    /**
     * Get the instanceNo property: The central services instance number.
     *
     * @return the instanceNo value.
     */
    public String instanceNo() {
        return this.instanceNo;
    }

    /**
     * Get the subnet property: The central services instance subnet.
     *
     * @return the subnet value.
     */
    public String subnet() {
        return this.subnet;
    }

    /**
     * Get the messageServerProperties property: Defines the SAP Message Server properties.
     *
     * @return the messageServerProperties value.
     */
    public MessageServerProperties messageServerProperties() {
        return this.messageServerProperties;
    }

    /**
     * Set the messageServerProperties property: Defines the SAP Message Server properties.
     *
     * @param messageServerProperties the messageServerProperties value to set.
     * @return the SapCentralServerProperties object itself.
     */
    public SapCentralServerProperties withMessageServerProperties(MessageServerProperties messageServerProperties) {
        this.messageServerProperties = messageServerProperties;
        return this;
    }

    /**
     * Get the enqueueServerProperties property: Defines the SAP Enqueue Server properties.
     *
     * @return the enqueueServerProperties value.
     */
    public EnqueueServerProperties enqueueServerProperties() {
        return this.enqueueServerProperties;
    }

    /**
     * Set the enqueueServerProperties property: Defines the SAP Enqueue Server properties.
     *
     * @param enqueueServerProperties the enqueueServerProperties value to set.
     * @return the SapCentralServerProperties object itself.
     */
    public SapCentralServerProperties withEnqueueServerProperties(EnqueueServerProperties enqueueServerProperties) {
        this.enqueueServerProperties = enqueueServerProperties;
        return this;
    }

    /**
     * Get the gatewayServerProperties property: Defines the SAP Gateway Server properties.
     *
     * @return the gatewayServerProperties value.
     */
    public GatewayServerProperties gatewayServerProperties() {
        return this.gatewayServerProperties;
    }

    /**
     * Set the gatewayServerProperties property: Defines the SAP Gateway Server properties.
     *
     * @param gatewayServerProperties the gatewayServerProperties value to set.
     * @return the SapCentralServerProperties object itself.
     */
    public SapCentralServerProperties withGatewayServerProperties(GatewayServerProperties gatewayServerProperties) {
        this.gatewayServerProperties = gatewayServerProperties;
        return this;
    }

    /**
     * Get the enqueueReplicationServerProperties property: Defines the SAP Enqueue Replication Server (ERS) properties.
     *
     * @return the enqueueReplicationServerProperties value.
     */
    public EnqueueReplicationServerProperties enqueueReplicationServerProperties() {
        return this.enqueueReplicationServerProperties;
    }

    /**
     * Set the enqueueReplicationServerProperties property: Defines the SAP Enqueue Replication Server (ERS) properties.
     *
     * @param enqueueReplicationServerProperties the enqueueReplicationServerProperties value to set.
     * @return the SapCentralServerProperties object itself.
     */
    public SapCentralServerProperties withEnqueueReplicationServerProperties(
        EnqueueReplicationServerProperties enqueueReplicationServerProperties) {
        this.enqueueReplicationServerProperties = enqueueReplicationServerProperties;
        return this;
    }

    /**
     * Get the kernelVersion property: The central services instance Kernel Version.
     *
     * @return the kernelVersion value.
     */
    public String kernelVersion() {
        return this.kernelVersion;
    }

    /**
     * Get the kernelPatch property: The central services instance Kernel Patch level.
     *
     * @return the kernelPatch value.
     */
    public String kernelPatch() {
        return this.kernelPatch;
    }

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

    /**
     * Get the vmDetails property: The list of virtual machines corresponding to the Central Services instance.
     *
     * @return the vmDetails value.
     */
    public List<CentralServerVmDetails> 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 errors related to SAP Central Services Instance resource.
     *
     * @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 (messageServerProperties() != null) {
            messageServerProperties().validate();
        }
        if (enqueueServerProperties() != null) {
            enqueueServerProperties().validate();
        }
        if (gatewayServerProperties() != null) {
            gatewayServerProperties().validate();
        }
        if (enqueueReplicationServerProperties() != null) {
            enqueueReplicationServerProperties().validate();
        }
        if (loadBalancerDetails() != null) {
            loadBalancerDetails().validate();
        }
        if (vmDetails() != null) {
            vmDetails().forEach(e -> e.validate());
        }
        if (errors() != null) {
            errors().validate();
        }
    }
}
