// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.datamigration.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.datamigration.models.ServiceProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Properties of the Data Migration service instance. */
@Fluent
public final class DataMigrationServiceProperties {
    /*
     * The resource's provisioning state
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ServiceProvisioningState provisioningState;

    /*
     * The public key of the service, used to encrypt secrets sent to the service
     */
    @JsonProperty(value = "publicKey")
    private String publicKey;

    /*
     * The ID of the Microsoft.Network/virtualNetworks/subnets resource to which the service should be joined
     */
    @JsonProperty(value = "virtualSubnetId", required = true)
    private String virtualSubnetId;

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

    /**
     * Get the provisioningState property: The resource's provisioning state.
     *
     * @return the provisioningState value.
     */
    public ServiceProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the publicKey property: The public key of the service, used to encrypt secrets sent to the service.
     *
     * @return the publicKey value.
     */
    public String publicKey() {
        return this.publicKey;
    }

    /**
     * Set the publicKey property: The public key of the service, used to encrypt secrets sent to the service.
     *
     * @param publicKey the publicKey value to set.
     * @return the DataMigrationServiceProperties object itself.
     */
    public DataMigrationServiceProperties withPublicKey(String publicKey) {
        this.publicKey = publicKey;
        return this;
    }

    /**
     * Get the virtualSubnetId property: The ID of the Microsoft.Network/virtualNetworks/subnets resource to which the
     * service should be joined.
     *
     * @return the virtualSubnetId value.
     */
    public String virtualSubnetId() {
        return this.virtualSubnetId;
    }

    /**
     * Set the virtualSubnetId property: The ID of the Microsoft.Network/virtualNetworks/subnets resource to which the
     * service should be joined.
     *
     * @param virtualSubnetId the virtualSubnetId value to set.
     * @return the DataMigrationServiceProperties object itself.
     */
    public DataMigrationServiceProperties withVirtualSubnetId(String virtualSubnetId) {
        this.virtualSubnetId = virtualSubnetId;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (virtualSubnetId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property virtualSubnetId in model DataMigrationServiceProperties"));
        }
    }

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