// 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. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "softwareInstallationType")
@JsonTypeName("ServiceInitiated")
@Fluent
public final class ServiceInitiatedSoftwareConfiguration extends SoftwareConfiguration {
    /*
     * The URL to the SAP Build of Materials(BOM) file.
     */
    @JsonProperty(value = "bomUrl", required = true)
    private String bomUrl;

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

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

    /*
     * The FQDN to set for the SAP system during install.
     */
    @JsonProperty(value = "sapFqdn", required = true)
    private String sapFqdn;

    /*
     * The SSH private key.
     */
    @JsonProperty(value = "sshPrivateKey", required = true)
    private String sshPrivateKey;

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

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

    /**
     * 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 ServiceInitiatedSoftwareConfiguration object itself.
     */
    public ServiceInitiatedSoftwareConfiguration withBomUrl(String bomUrl) {
        this.bomUrl = bomUrl;
        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 ServiceInitiatedSoftwareConfiguration object itself.
     */
    public ServiceInitiatedSoftwareConfiguration withSoftwareVersion(String softwareVersion) {
        this.softwareVersion = softwareVersion;
        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 ServiceInitiatedSoftwareConfiguration object itself.
     */
    public ServiceInitiatedSoftwareConfiguration withSapBitsStorageAccountId(String sapBitsStorageAccountId) {
        this.sapBitsStorageAccountId = sapBitsStorageAccountId;
        return this;
    }

    /**
     * Get the sapFqdn property: The FQDN to set for the SAP system during install.
     *
     * @return the sapFqdn value.
     */
    public String sapFqdn() {
        return this.sapFqdn;
    }

    /**
     * Set the sapFqdn property: The FQDN to set for the SAP system during install.
     *
     * @param sapFqdn the sapFqdn value to set.
     * @return the ServiceInitiatedSoftwareConfiguration object itself.
     */
    public ServiceInitiatedSoftwareConfiguration withSapFqdn(String sapFqdn) {
        this.sapFqdn = sapFqdn;
        return this;
    }

    /**
     * Get the sshPrivateKey property: The SSH private key.
     *
     * @return the sshPrivateKey value.
     */
    public String sshPrivateKey() {
        return this.sshPrivateKey;
    }

    /**
     * Set the sshPrivateKey property: The SSH private key.
     *
     * @param sshPrivateKey the sshPrivateKey value to set.
     * @return the ServiceInitiatedSoftwareConfiguration object itself.
     */
    public ServiceInitiatedSoftwareConfiguration withSshPrivateKey(String sshPrivateKey) {
        this.sshPrivateKey = sshPrivateKey;
        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 ServiceInitiatedSoftwareConfiguration object itself.
     */
    public ServiceInitiatedSoftwareConfiguration 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 ServiceInitiatedSoftwareConfiguration"));
        }
        if (softwareVersion() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property softwareVersion in model ServiceInitiatedSoftwareConfiguration"));
        }
        if (sapBitsStorageAccountId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property sapBitsStorageAccountId in model"
                            + " ServiceInitiatedSoftwareConfiguration"));
        }
        if (sapFqdn() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property sapFqdn in model ServiceInitiatedSoftwareConfiguration"));
        }
        if (sshPrivateKey() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property sshPrivateKey in model ServiceInitiatedSoftwareConfiguration"));
        }
        if (highAvailabilitySoftwareConfiguration() != null) {
            highAvailabilitySoftwareConfiguration().validate();
        }
    }

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