// 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.DatabaseVmDetails;
import com.azure.resourcemanager.workloads.models.LoadBalancerDetails;
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 Database properties. */
@Immutable
public final class SapDatabaseProperties {
    /*
     * Database subnet.
     */
    @JsonProperty(value = "subnet", access = JsonProperty.Access.WRITE_ONLY)
    private String subnet;

    /*
     * Database SID name.
     */
    @JsonProperty(value = "databaseSid", access = JsonProperty.Access.WRITE_ONLY)
    private String databaseSid;

    /*
     * Database type, that is if the DB is HANA, DB2, Oracle, SAP ASE, Max DB or MS SQL Server.
     */
    @JsonProperty(value = "databaseType", access = JsonProperty.Access.WRITE_ONLY)
    private String databaseType;

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

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

    /*
     * The list of virtual machines corresponding to the Database resource.
     */
    @JsonProperty(value = "vmDetails", access = JsonProperty.Access.WRITE_ONLY)
    private List<DatabaseVmDetails> vmDetails;

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

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

    /*
     * Defines the errors related to Database resource.
     */
    @JsonProperty(value = "errors", access = JsonProperty.Access.WRITE_ONLY)
    private SapVirtualInstanceError errors;

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

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

    /**
     * Get the databaseSid property: Database SID name.
     *
     * @return the databaseSid value.
     */
    public String databaseSid() {
        return this.databaseSid;
    }

    /**
     * Get the databaseType property: Database type, that is if the DB is HANA, DB2, Oracle, SAP ASE, Max DB or MS SQL
     * Server.
     *
     * @return the databaseType value.
     */
    public String databaseType() {
        return this.databaseType;
    }

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

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

    /**
     * Get the vmDetails property: The list of virtual machines corresponding to the Database resource.
     *
     * @return the vmDetails value.
     */
    public List<DatabaseVmDetails> 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 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 Database 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 (loadBalancerDetails() != null) {
            loadBalancerDetails().validate();
        }
        if (vmDetails() != null) {
            vmDetails().forEach(e -> e.validate());
        }
        if (errors() != null) {
            errors().validate();
        }
    }
}
