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

package com.azure.resourcemanager.devtestlabs.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.devtestlabs.models.EnableStatus;
import com.azure.resourcemanager.devtestlabs.models.SourceControlType;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

/** Properties of an artifact source. */
@Fluent
public final class ArtifactSourceInner extends Resource {
    /*
     * The properties of the resource.
     */
    @JsonProperty(value = "properties", required = true)
    private ArtifactSourceProperties innerProperties = new ArtifactSourceProperties();

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

    /**
     * Get the innerProperties property: The properties of the resource.
     *
     * @return the innerProperties value.
     */
    private ArtifactSourceProperties innerProperties() {
        return this.innerProperties;
    }

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

    /** {@inheritDoc} */
    @Override
    public ArtifactSourceInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the displayName property: The artifact source's display name.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.innerProperties() == null ? null : this.innerProperties().displayName();
    }

    /**
     * Set the displayName property: The artifact source's display name.
     *
     * @param displayName the displayName value to set.
     * @return the ArtifactSourceInner object itself.
     */
    public ArtifactSourceInner withDisplayName(String displayName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ArtifactSourceProperties();
        }
        this.innerProperties().withDisplayName(displayName);
        return this;
    }

    /**
     * Get the uri property: The artifact source's URI.
     *
     * @return the uri value.
     */
    public String uri() {
        return this.innerProperties() == null ? null : this.innerProperties().uri();
    }

    /**
     * Set the uri property: The artifact source's URI.
     *
     * @param uri the uri value to set.
     * @return the ArtifactSourceInner object itself.
     */
    public ArtifactSourceInner withUri(String uri) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ArtifactSourceProperties();
        }
        this.innerProperties().withUri(uri);
        return this;
    }

    /**
     * Get the sourceType property: The artifact source's type.
     *
     * @return the sourceType value.
     */
    public SourceControlType sourceType() {
        return this.innerProperties() == null ? null : this.innerProperties().sourceType();
    }

    /**
     * Set the sourceType property: The artifact source's type.
     *
     * @param sourceType the sourceType value to set.
     * @return the ArtifactSourceInner object itself.
     */
    public ArtifactSourceInner withSourceType(SourceControlType sourceType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ArtifactSourceProperties();
        }
        this.innerProperties().withSourceType(sourceType);
        return this;
    }

    /**
     * Get the folderPath property: The folder containing artifacts.
     *
     * @return the folderPath value.
     */
    public String folderPath() {
        return this.innerProperties() == null ? null : this.innerProperties().folderPath();
    }

    /**
     * Set the folderPath property: The folder containing artifacts.
     *
     * @param folderPath the folderPath value to set.
     * @return the ArtifactSourceInner object itself.
     */
    public ArtifactSourceInner withFolderPath(String folderPath) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ArtifactSourceProperties();
        }
        this.innerProperties().withFolderPath(folderPath);
        return this;
    }

    /**
     * Get the armTemplateFolderPath property: The folder containing Azure Resource Manager templates.
     *
     * @return the armTemplateFolderPath value.
     */
    public String armTemplateFolderPath() {
        return this.innerProperties() == null ? null : this.innerProperties().armTemplateFolderPath();
    }

    /**
     * Set the armTemplateFolderPath property: The folder containing Azure Resource Manager templates.
     *
     * @param armTemplateFolderPath the armTemplateFolderPath value to set.
     * @return the ArtifactSourceInner object itself.
     */
    public ArtifactSourceInner withArmTemplateFolderPath(String armTemplateFolderPath) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ArtifactSourceProperties();
        }
        this.innerProperties().withArmTemplateFolderPath(armTemplateFolderPath);
        return this;
    }

    /**
     * Get the branchRef property: The artifact source's branch reference.
     *
     * @return the branchRef value.
     */
    public String branchRef() {
        return this.innerProperties() == null ? null : this.innerProperties().branchRef();
    }

    /**
     * Set the branchRef property: The artifact source's branch reference.
     *
     * @param branchRef the branchRef value to set.
     * @return the ArtifactSourceInner object itself.
     */
    public ArtifactSourceInner withBranchRef(String branchRef) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ArtifactSourceProperties();
        }
        this.innerProperties().withBranchRef(branchRef);
        return this;
    }

    /**
     * Get the securityToken property: The security token to authenticate to the artifact source.
     *
     * @return the securityToken value.
     */
    public String securityToken() {
        return this.innerProperties() == null ? null : this.innerProperties().securityToken();
    }

    /**
     * Set the securityToken property: The security token to authenticate to the artifact source.
     *
     * @param securityToken the securityToken value to set.
     * @return the ArtifactSourceInner object itself.
     */
    public ArtifactSourceInner withSecurityToken(String securityToken) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ArtifactSourceProperties();
        }
        this.innerProperties().withSecurityToken(securityToken);
        return this;
    }

    /**
     * Get the status property: Indicates if the artifact source is enabled (values: Enabled, Disabled).
     *
     * @return the status value.
     */
    public EnableStatus status() {
        return this.innerProperties() == null ? null : this.innerProperties().status();
    }

    /**
     * Set the status property: Indicates if the artifact source is enabled (values: Enabled, Disabled).
     *
     * @param status the status value to set.
     * @return the ArtifactSourceInner object itself.
     */
    public ArtifactSourceInner withStatus(EnableStatus status) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ArtifactSourceProperties();
        }
        this.innerProperties().withStatus(status);
        return this;
    }

    /**
     * Get the createdDate property: The artifact source's creation date.
     *
     * @return the createdDate value.
     */
    public OffsetDateTime createdDate() {
        return this.innerProperties() == null ? null : this.innerProperties().createdDate();
    }

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

    /**
     * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid).
     *
     * @return the uniqueIdentifier value.
     */
    public String uniqueIdentifier() {
        return this.innerProperties() == null ? null : this.innerProperties().uniqueIdentifier();
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property innerProperties in model ArtifactSourceInner"));
        } else {
            innerProperties().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(ArtifactSourceInner.class);
}
