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

package com.azure.resourcemanager.synapse.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.synapse.fluent.models.DataConnectionInner;
import com.azure.resourcemanager.synapse.fluent.models.IotHubConnectionProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.util.List;

/** Class representing an iot hub data connection. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind")
@JsonTypeName("IotHub")
@Fluent
public final class IotHubDataConnection extends DataConnectionInner {
    /*
     * The Iot Hub data connection properties.
     */
    @JsonProperty(value = "properties")
    private IotHubConnectionProperties innerProperties;

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

    /**
     * Get the innerProperties property: The Iot Hub data connection properties.
     *
     * @return the innerProperties value.
     */
    private IotHubConnectionProperties innerProperties() {
        return this.innerProperties;
    }

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

    /**
     * Get the iotHubResourceId property: The resource ID of the Iot hub to be used to create a data connection.
     *
     * @return the iotHubResourceId value.
     */
    public String iotHubResourceId() {
        return this.innerProperties() == null ? null : this.innerProperties().iotHubResourceId();
    }

    /**
     * Set the iotHubResourceId property: The resource ID of the Iot hub to be used to create a data connection.
     *
     * @param iotHubResourceId the iotHubResourceId value to set.
     * @return the IotHubDataConnection object itself.
     */
    public IotHubDataConnection withIotHubResourceId(String iotHubResourceId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IotHubConnectionProperties();
        }
        this.innerProperties().withIotHubResourceId(iotHubResourceId);
        return this;
    }

    /**
     * Get the consumerGroup property: The iot hub consumer group.
     *
     * @return the consumerGroup value.
     */
    public String consumerGroup() {
        return this.innerProperties() == null ? null : this.innerProperties().consumerGroup();
    }

    /**
     * Set the consumerGroup property: The iot hub consumer group.
     *
     * @param consumerGroup the consumerGroup value to set.
     * @return the IotHubDataConnection object itself.
     */
    public IotHubDataConnection withConsumerGroup(String consumerGroup) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IotHubConnectionProperties();
        }
        this.innerProperties().withConsumerGroup(consumerGroup);
        return this;
    }

    /**
     * Get the tableName property: The table where the data should be ingested. Optionally the table information can be
     * added to each message.
     *
     * @return the tableName value.
     */
    public String tableName() {
        return this.innerProperties() == null ? null : this.innerProperties().tableName();
    }

    /**
     * Set the tableName property: The table where the data should be ingested. Optionally the table information can be
     * added to each message.
     *
     * @param tableName the tableName value to set.
     * @return the IotHubDataConnection object itself.
     */
    public IotHubDataConnection withTableName(String tableName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IotHubConnectionProperties();
        }
        this.innerProperties().withTableName(tableName);
        return this;
    }

    /**
     * Get the mappingRuleName property: The mapping rule to be used to ingest the data. Optionally the mapping
     * information can be added to each message.
     *
     * @return the mappingRuleName value.
     */
    public String mappingRuleName() {
        return this.innerProperties() == null ? null : this.innerProperties().mappingRuleName();
    }

    /**
     * Set the mappingRuleName property: The mapping rule to be used to ingest the data. Optionally the mapping
     * information can be added to each message.
     *
     * @param mappingRuleName the mappingRuleName value to set.
     * @return the IotHubDataConnection object itself.
     */
    public IotHubDataConnection withMappingRuleName(String mappingRuleName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IotHubConnectionProperties();
        }
        this.innerProperties().withMappingRuleName(mappingRuleName);
        return this;
    }

    /**
     * Get the dataFormat property: The data format of the message. Optionally the data format can be added to each
     * message.
     *
     * @return the dataFormat value.
     */
    public IotHubDataFormat dataFormat() {
        return this.innerProperties() == null ? null : this.innerProperties().dataFormat();
    }

    /**
     * Set the dataFormat property: The data format of the message. Optionally the data format can be added to each
     * message.
     *
     * @param dataFormat the dataFormat value to set.
     * @return the IotHubDataConnection object itself.
     */
    public IotHubDataConnection withDataFormat(IotHubDataFormat dataFormat) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IotHubConnectionProperties();
        }
        this.innerProperties().withDataFormat(dataFormat);
        return this;
    }

    /**
     * Get the eventSystemProperties property: System properties of the iot hub.
     *
     * @return the eventSystemProperties value.
     */
    public List<String> eventSystemProperties() {
        return this.innerProperties() == null ? null : this.innerProperties().eventSystemProperties();
    }

    /**
     * Set the eventSystemProperties property: System properties of the iot hub.
     *
     * @param eventSystemProperties the eventSystemProperties value to set.
     * @return the IotHubDataConnection object itself.
     */
    public IotHubDataConnection withEventSystemProperties(List<String> eventSystemProperties) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IotHubConnectionProperties();
        }
        this.innerProperties().withEventSystemProperties(eventSystemProperties);
        return this;
    }

    /**
     * Get the sharedAccessPolicyName property: The name of the share access policy.
     *
     * @return the sharedAccessPolicyName value.
     */
    public String sharedAccessPolicyName() {
        return this.innerProperties() == null ? null : this.innerProperties().sharedAccessPolicyName();
    }

    /**
     * Set the sharedAccessPolicyName property: The name of the share access policy.
     *
     * @param sharedAccessPolicyName the sharedAccessPolicyName value to set.
     * @return the IotHubDataConnection object itself.
     */
    public IotHubDataConnection withSharedAccessPolicyName(String sharedAccessPolicyName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IotHubConnectionProperties();
        }
        this.innerProperties().withSharedAccessPolicyName(sharedAccessPolicyName);
        return this;
    }

    /**
     * Get the provisioningState property: The provisioned state of the resource.
     *
     * @return the provisioningState value.
     */
    public ResourceProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

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