// 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.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/** The SAP Software configuration Input when the software is to be installed by service without OS Configurations. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "softwareInstallationType")
@JsonTypeName("SAPInstallWithoutOSConfig")
@Fluent
public final class SapInstallWithoutOSConfigSoftwareConfiguration extends SoftwareConfiguration {
    /*
     * The URL to the SAP Build of Materials(BOM) file.
     */
    @JsonProperty(value = "bomUrl", required = true)
    private String bomUrl;

    /*
     * The SAP bits storage account id.
     */
    @JsonProperty(value = "sapBitsStorageAccountId", required = true)
    private String sapBitsStorageAccountId;

    /*
     * The software version to install.
     */
    @JsonProperty(value = "softwareVersion", required = true)
    private String softwareVersion;

    /*
     * Gets or sets the HA software configuration.
     */
    @JsonProperty(value = "highAvailabilitySoftwareConfiguration")
    private HighAvailabilitySoftwareConfiguration highAvailabilitySoftwareConfiguration;

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

    /**
     * Get the bomUrl property: The URL to the SAP Build of Materials(BOM) file.
     *
     * @return the bomUrl value.
     */
    public String bomUrl() {
        return this.bomUrl;
    }

    /**
     * Set the bomUrl property: The URL to the SAP Build of Materials(BOM) file.
     *
     * @param bomUrl the bomUrl value to set.
     * @return the SapInstallWithoutOSConfigSoftwareConfiguration object itself.
     */
    public SapInstallWithoutOSConfigSoftwareConfiguration withBomUrl(String bomUrl) {
        this.bomUrl = bomUrl;
        return this;
    }

    /**
     * Get the sapBitsStorageAccountId property: The SAP bits storage account id.
     *
     * @return the sapBitsStorageAccountId value.
     */
    public String sapBitsStorageAccountId() {
        return this.sapBitsStorageAccountId;
    }

    /**
     * Set the sapBitsStorageAccountId property: The SAP bits storage account id.
     *
     * @param sapBitsStorageAccountId the sapBitsStorageAccountId value to set.
     * @return the SapInstallWithoutOSConfigSoftwareConfiguration object itself.
     */
    public SapInstallWithoutOSConfigSoftwareConfiguration withSapBitsStorageAccountId(String sapBitsStorageAccountId) {
        this.sapBitsStorageAccountId = sapBitsStorageAccountId;
        return this;
    }

    /**
     * Get the softwareVersion property: The software version to install.
     *
     * @return the softwareVersion value.
     */
    public String softwareVersion() {
        return this.softwareVersion;
    }

    /**
     * Set the softwareVersion property: The software version to install.
     *
     * @param softwareVersion the softwareVersion value to set.
     * @return the SapInstallWithoutOSConfigSoftwareConfiguration object itself.
     */
    public SapInstallWithoutOSConfigSoftwareConfiguration withSoftwareVersion(String softwareVersion) {
        this.softwareVersion = softwareVersion;
        return this;
    }

    /**
     * Get the highAvailabilitySoftwareConfiguration property: Gets or sets the HA software configuration.
     *
     * @return the highAvailabilitySoftwareConfiguration value.
     */
    public HighAvailabilitySoftwareConfiguration highAvailabilitySoftwareConfiguration() {
        return this.highAvailabilitySoftwareConfiguration;
    }

    /**
     * Set the highAvailabilitySoftwareConfiguration property: Gets or sets the HA software configuration.
     *
     * @param highAvailabilitySoftwareConfiguration the highAvailabilitySoftwareConfiguration value to set.
     * @return the SapInstallWithoutOSConfigSoftwareConfiguration object itself.
     */
    public SapInstallWithoutOSConfigSoftwareConfiguration withHighAvailabilitySoftwareConfiguration(
        HighAvailabilitySoftwareConfiguration highAvailabilitySoftwareConfiguration) {
        this.highAvailabilitySoftwareConfiguration = highAvailabilitySoftwareConfiguration;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (bomUrl() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property bomUrl in model SapInstallWithoutOSConfigSoftwareConfiguration"));
        }
        if (sapBitsStorageAccountId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property sapBitsStorageAccountId in model"
                            + " SapInstallWithoutOSConfigSoftwareConfiguration"));
        }
        if (softwareVersion() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property softwareVersion in model"
                            + " SapInstallWithoutOSConfigSoftwareConfiguration"));
        }
        if (highAvailabilitySoftwareConfiguration() != null) {
            highAvailabilitySoftwareConfiguration().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(SapInstallWithoutOSConfigSoftwareConfiguration.class);
}
