// 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.PrivateLinkServiceConnectionProperties;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** A grouping of information about the connection to the remote resource. */
@Fluent
public final class PrivateLinkServiceConnection {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkServiceConnection.class);

    /*
     * Bag of properties defining a privatelinkServiceConnection.
     */
    @JsonProperty(value = "properties")
    private PrivateLinkServiceConnectionProperties innerProperties;

    /**
     * Get the innerProperties property: Bag of properties defining a privatelinkServiceConnection.
     *
     * @return the innerProperties value.
     */
    private PrivateLinkServiceConnectionProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the privateLinkServiceId property: The resource id of the private link service. Required on PUT
     * (CreateOrUpdate) requests.
     *
     * @return the privateLinkServiceId value.
     */
    public String privateLinkServiceId() {
        return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceId();
    }

    /**
     * Set the privateLinkServiceId property: The resource id of the private link service. Required on PUT
     * (CreateOrUpdate) requests.
     *
     * @param privateLinkServiceId the privateLinkServiceId value to set.
     * @return the PrivateLinkServiceConnection object itself.
     */
    public PrivateLinkServiceConnection withPrivateLinkServiceId(String privateLinkServiceId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PrivateLinkServiceConnectionProperties();
        }
        this.innerProperties().withPrivateLinkServiceId(privateLinkServiceId);
        return this;
    }

    /**
     * Get the groupIds property: The ID(s) of the group(s) obtained from the remote resource that this private endpoint
     * should connect to. Required on PUT (CreateOrUpdate) requests.
     *
     * @return the groupIds value.
     */
    public List<String> groupIds() {
        return this.innerProperties() == null ? null : this.innerProperties().groupIds();
    }

    /**
     * Set the groupIds property: The ID(s) of the group(s) obtained from the remote resource that this private endpoint
     * should connect to. Required on PUT (CreateOrUpdate) requests.
     *
     * @param groupIds the groupIds value to set.
     * @return the PrivateLinkServiceConnection object itself.
     */
    public PrivateLinkServiceConnection withGroupIds(List<String> groupIds) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PrivateLinkServiceConnectionProperties();
        }
        this.innerProperties().withGroupIds(groupIds);
        return this;
    }

    /**
     * Get the requestMessage property: A message passed to the owner of the remote resource with this connection
     * request. Restricted to 140 chars.
     *
     * @return the requestMessage value.
     */
    public String requestMessage() {
        return this.innerProperties() == null ? null : this.innerProperties().requestMessage();
    }

    /**
     * Get the privateLinkServiceConnectionState property: A collection of read-only information about the state of the
     * connection to the private remote resource.
     *
     * @return the privateLinkServiceConnectionState value.
     */
    public PrivateLinkConnectionState privateLinkServiceConnectionState() {
        return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState();
    }

    /**
     * Set the privateLinkServiceConnectionState property: A collection of read-only information about the state of the
     * connection to the private remote resource.
     *
     * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set.
     * @return the PrivateLinkServiceConnection object itself.
     */
    public PrivateLinkServiceConnection withPrivateLinkServiceConnectionState(
        PrivateLinkConnectionState privateLinkServiceConnectionState) {
        if (this.innerProperties() == null) {
            this.innerProperties = new PrivateLinkServiceConnectionProperties();
        }
        this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState);
        return this;
    }

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