// 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 PatAuthTypeWorkspaceConnectionProperties model. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authType")
@JsonTypeName("PAT")
@Fluent
public final class PatAuthTypeWorkspaceConnectionProperties extends WorkspaceConnectionPropertiesV2 {
    /*
     * The credentials property.
     */
    @JsonProperty(value = "credentials")
    private WorkspaceConnectionPersonalAccessToken credentials;

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

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

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

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

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

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

    /** {@inheritDoc} */
    @Override
    public PatAuthTypeWorkspaceConnectionProperties 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();
        }
    }
}
