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

package com.azure.resourcemanager.streamanalytics.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.streamanalytics.fluent.models.PowerBIOutputDataSourceProperties;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/** Describes a Power BI output data source. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonTypeName("PowerBI")
@Fluent
public final class PowerBIOutputDataSource extends OutputDataSource {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(PowerBIOutputDataSource.class);

    /*
     * The properties that are associated with a Power BI output. Required on
     * PUT (CreateOrReplace) requests.
     */
    @JsonProperty(value = "properties")
    private PowerBIOutputDataSourceProperties innerProperties;

    /**
     * Get the innerProperties property: The properties that are associated with a Power BI output. Required on PUT
     * (CreateOrReplace) requests.
     *
     * @return the innerProperties value.
     */
    private PowerBIOutputDataSourceProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the dataset property: The name of the Power BI dataset. Required on PUT (CreateOrReplace) requests.
     *
     * @return the dataset value.
     */
    public String dataset() {
        return this.innerProperties() == null ? null : this.innerProperties().dataset();
    }

    /**
     * Set the dataset property: The name of the Power BI dataset. Required on PUT (CreateOrReplace) requests.
     *
     * @param dataset the dataset value to set.
     * @return the PowerBIOutputDataSource object itself.
     */
    public PowerBIOutputDataSource withDataset(String dataset) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PowerBIOutputDataSourceProperties();
        }
        this.innerProperties().withDataset(dataset);
        return this;
    }

    /**
     * Get the table property: The name of the Power BI table under the specified dataset. Required on PUT
     * (CreateOrReplace) requests.
     *
     * @return the table value.
     */
    public String table() {
        return this.innerProperties() == null ? null : this.innerProperties().table();
    }

    /**
     * Set the table property: The name of the Power BI table under the specified dataset. Required on PUT
     * (CreateOrReplace) requests.
     *
     * @param table the table value to set.
     * @return the PowerBIOutputDataSource object itself.
     */
    public PowerBIOutputDataSource withTable(String table) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PowerBIOutputDataSourceProperties();
        }
        this.innerProperties().withTable(table);
        return this;
    }

    /**
     * Get the groupId property: The ID of the Power BI group.
     *
     * @return the groupId value.
     */
    public String groupId() {
        return this.innerProperties() == null ? null : this.innerProperties().groupId();
    }

    /**
     * Set the groupId property: The ID of the Power BI group.
     *
     * @param groupId the groupId value to set.
     * @return the PowerBIOutputDataSource object itself.
     */
    public PowerBIOutputDataSource withGroupId(String groupId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PowerBIOutputDataSourceProperties();
        }
        this.innerProperties().withGroupId(groupId);
        return this;
    }

    /**
     * Get the groupName property: The name of the Power BI group. Use this property to help remember which specific
     * Power BI group id was used.
     *
     * @return the groupName value.
     */
    public String groupName() {
        return this.innerProperties() == null ? null : this.innerProperties().groupName();
    }

    /**
     * Set the groupName property: The name of the Power BI group. Use this property to help remember which specific
     * Power BI group id was used.
     *
     * @param groupName the groupName value to set.
     * @return the PowerBIOutputDataSource object itself.
     */
    public PowerBIOutputDataSource withGroupName(String groupName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PowerBIOutputDataSourceProperties();
        }
        this.innerProperties().withGroupName(groupName);
        return this;
    }

    /**
     * Get the authenticationMode property: Authentication Mode.
     *
     * @return the authenticationMode value.
     */
    public AuthenticationMode authenticationMode() {
        return this.innerProperties() == null ? null : this.innerProperties().authenticationMode();
    }

    /**
     * Set the authenticationMode property: Authentication Mode.
     *
     * @param authenticationMode the authenticationMode value to set.
     * @return the PowerBIOutputDataSource object itself.
     */
    public PowerBIOutputDataSource withAuthenticationMode(AuthenticationMode authenticationMode) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PowerBIOutputDataSourceProperties();
        }
        this.innerProperties().withAuthenticationMode(authenticationMode);
        return this;
    }

    /**
     * Get the refreshToken property: A refresh token that can be used to obtain a valid access token that can then be
     * used to authenticate with the data source. A valid refresh token is currently only obtainable via the Azure
     * Portal. It is recommended to put a dummy string value here when creating the data source and then going to the
     * Azure Portal to authenticate the data source which will update this property with a valid refresh token. Required
     * on PUT (CreateOrReplace) requests.
     *
     * @return the refreshToken value.
     */
    public String refreshToken() {
        return this.innerProperties() == null ? null : this.innerProperties().refreshToken();
    }

    /**
     * Set the refreshToken property: A refresh token that can be used to obtain a valid access token that can then be
     * used to authenticate with the data source. A valid refresh token is currently only obtainable via the Azure
     * Portal. It is recommended to put a dummy string value here when creating the data source and then going to the
     * Azure Portal to authenticate the data source which will update this property with a valid refresh token. Required
     * on PUT (CreateOrReplace) requests.
     *
     * @param refreshToken the refreshToken value to set.
     * @return the PowerBIOutputDataSource object itself.
     */
    public PowerBIOutputDataSource withRefreshToken(String refreshToken) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PowerBIOutputDataSourceProperties();
        }
        this.innerProperties().withRefreshToken(refreshToken);
        return this;
    }

    /**
     * Get the tokenUserPrincipalName property: The user principal name (UPN) of the user that was used to obtain the
     * refresh token. Use this property to help remember which user was used to obtain the refresh token.
     *
     * @return the tokenUserPrincipalName value.
     */
    public String tokenUserPrincipalName() {
        return this.innerProperties() == null ? null : this.innerProperties().tokenUserPrincipalName();
    }

    /**
     * Set the tokenUserPrincipalName property: The user principal name (UPN) of the user that was used to obtain the
     * refresh token. Use this property to help remember which user was used to obtain the refresh token.
     *
     * @param tokenUserPrincipalName the tokenUserPrincipalName value to set.
     * @return the PowerBIOutputDataSource object itself.
     */
    public PowerBIOutputDataSource withTokenUserPrincipalName(String tokenUserPrincipalName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PowerBIOutputDataSourceProperties();
        }
        this.innerProperties().withTokenUserPrincipalName(tokenUserPrincipalName);
        return this;
    }

    /**
     * Get the tokenUserDisplayName property: The user display name of the user that was used to obtain the refresh
     * token. Use this property to help remember which user was used to obtain the refresh token.
     *
     * @return the tokenUserDisplayName value.
     */
    public String tokenUserDisplayName() {
        return this.innerProperties() == null ? null : this.innerProperties().tokenUserDisplayName();
    }

    /**
     * Set the tokenUserDisplayName property: The user display name of the user that was used to obtain the refresh
     * token. Use this property to help remember which user was used to obtain the refresh token.
     *
     * @param tokenUserDisplayName the tokenUserDisplayName value to set.
     * @return the PowerBIOutputDataSource object itself.
     */
    public PowerBIOutputDataSource withTokenUserDisplayName(String tokenUserDisplayName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PowerBIOutputDataSourceProperties();
        }
        this.innerProperties().withTokenUserDisplayName(tokenUserDisplayName);
        return this;
    }

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