// 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.management.Resource;
import com.azure.resourcemanager.datamigration.models.ServiceProvisioningState;
import com.azure.resourcemanager.datamigration.models.ServiceSku;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** A Database Migration Service resource. */
@Fluent
public final class DataMigrationServiceInner extends Resource {
    /*
     * HTTP strong entity tag value. Ignored if submitted
     */
    @JsonProperty(value = "etag")
    private String etag;

    /*
     * The resource kind. Only 'vm' (the default) is supported.
     */
    @JsonProperty(value = "kind")
    private String kind;

    /*
     * Custom service properties
     */
    @JsonProperty(value = "properties")
    private DataMigrationServiceProperties innerProperties;

    /*
     * Service SKU
     */
    @JsonProperty(value = "sku")
    private ServiceSku sku;

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

    /**
     * Get the etag property: HTTP strong entity tag value. Ignored if submitted.
     *
     * @return the etag value.
     */
    public String etag() {
        return this.etag;
    }

    /**
     * Set the etag property: HTTP strong entity tag value. Ignored if submitted.
     *
     * @param etag the etag value to set.
     * @return the DataMigrationServiceInner object itself.
     */
    public DataMigrationServiceInner withEtag(String etag) {
        this.etag = etag;
        return this;
    }

    /**
     * Get the kind property: The resource kind. Only 'vm' (the default) is supported.
     *
     * @return the kind value.
     */
    public String kind() {
        return this.kind;
    }

    /**
     * Set the kind property: The resource kind. Only 'vm' (the default) is supported.
     *
     * @param kind the kind value to set.
     * @return the DataMigrationServiceInner object itself.
     */
    public DataMigrationServiceInner withKind(String kind) {
        this.kind = kind;
        return this;
    }

    /**
     * Get the innerProperties property: Custom service properties.
     *
     * @return the innerProperties value.
     */
    private DataMigrationServiceProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the sku property: Service SKU.
     *
     * @return the sku value.
     */
    public ServiceSku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: Service SKU.
     *
     * @param sku the sku value to set.
     * @return the DataMigrationServiceInner object itself.
     */
    public DataMigrationServiceInner withSku(ServiceSku sku) {
        this.sku = sku;
        return this;
    }

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

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

    /**
     * Get the provisioningState property: The resource's provisioning state.
     *
     * @return the provisioningState value.
     */
    public ServiceProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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 DataMigrationServiceInner object itself.
     */
    public DataMigrationServiceInner withPublicKey(String publicKey) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DataMigrationServiceProperties();
        }
        this.innerProperties().withPublicKey(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.innerProperties() == null ? null : this.innerProperties().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 DataMigrationServiceInner object itself.
     */
    public DataMigrationServiceInner withVirtualSubnetId(String virtualSubnetId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DataMigrationServiceProperties();
        }
        this.innerProperties().withVirtualSubnetId(virtualSubnetId);
        return this;
    }

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