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

package com.azure.resourcemanager.machinelearning.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/** The SasAuthTypeWorkspaceConnectionProperties model. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authType")
@JsonTypeName("SAS")
@Fluent
public final class SasAuthTypeWorkspaceConnectionProperties extends WorkspaceConnectionPropertiesV2 {
    /*
     * The credentials property.
     */
    @JsonProperty(value = "credentials")
    private WorkspaceConnectionSharedAccessSignature credentials;

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

    /**
     * Get the credentials property: The credentials property.
     *
     * @return the credentials value.
     */
    public WorkspaceConnectionSharedAccessSignature credentials() {
        return this.credentials;
    }

    /**
     * Set the credentials property: The credentials property.
     *
     * @param credentials the credentials value to set.
     * @return the SasAuthTypeWorkspaceConnectionProperties object itself.
     */
    public SasAuthTypeWorkspaceConnectionProperties withCredentials(
        WorkspaceConnectionSharedAccessSignature credentials) {
        this.credentials = credentials;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public SasAuthTypeWorkspaceConnectionProperties withCategory(ConnectionCategory category) {
        super.withCategory(category);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public SasAuthTypeWorkspaceConnectionProperties withTarget(String target) {
        super.withTarget(target);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public SasAuthTypeWorkspaceConnectionProperties withValue(String value) {
        super.withValue(value);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public SasAuthTypeWorkspaceConnectionProperties withValueFormat(ValueFormat valueFormat) {
        super.withValueFormat(valueFormat);
        return this;
    }

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