// 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.core.management.Resource;
import com.azure.core.management.SystemData;
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;
import java.util.Map;

/** Define the SAP Central Services Instance resource. */
@Fluent
public final class SapCentralServerInstanceInner extends Resource {
    /*
     * Defines the SAP Central Services Instance properties.
     */
    @JsonProperty(value = "properties")
    private SapCentralServerProperties innerProperties;

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

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

    /**
     * Get the innerProperties property: Defines the SAP Central Services Instance properties.
     *
     * @return the innerProperties value.
     */
    private SapCentralServerProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /** {@inheritDoc} */
    @Override
    public SapCentralServerInstanceInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public SapCentralServerInstanceInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

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

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

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

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

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

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

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

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

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

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

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

    /**
     * Get the kernelPatch property: The central services instance Kernel Patch level.
     *
     * @return the kernelPatch value.
     */
    public String kernelPatch() {
        return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().vmDetails();
    }

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

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

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

    /**
     * Get the errors property: Defines the errors related to SAP Central Services Instance resource.
     *
     * @return the errors value.
     */
    public SapVirtualInstanceError errors() {
        return this.innerProperties() == null ? null : this.innerProperties().errors();
    }

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