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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.securityinsights.models.ContentType;
import com.azure.resourcemanager.securityinsights.models.DeploymentInfo;
import com.azure.resourcemanager.securityinsights.models.RepoType;
import com.azure.resourcemanager.securityinsights.models.Repository;
import com.azure.resourcemanager.securityinsights.models.RepositoryResourceInfo;
import com.azure.resourcemanager.securityinsights.models.ResourceWithEtag;
import com.azure.resourcemanager.securityinsights.models.Version;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Represents a SourceControl in Azure Security Insights. */
@Fluent
public final class SourceControlInner extends ResourceWithEtag {
    /*
     * source control properties
     */
    @JsonProperty(value = "properties")
    private SourceControlProperties innerProperties;

    /**
     * Get the innerProperties property: source control properties.
     *
     * @return the innerProperties value.
     */
    private SourceControlProperties innerProperties() {
        return this.innerProperties;
    }

    /** {@inheritDoc} */
    @Override
    public SourceControlInner withEtag(String etag) {
        super.withEtag(etag);
        return this;
    }

    /**
     * Get the id property: The id (a Guid) of the source control.
     *
     * @return the id value.
     */
    public String idPropertiesId() {
        return this.innerProperties() == null ? null : this.innerProperties().id();
    }

    /**
     * Set the id property: The id (a Guid) of the source control.
     *
     * @param id the id value to set.
     * @return the SourceControlInner object itself.
     */
    public SourceControlInner withIdPropertiesId(String id) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SourceControlProperties();
        }
        this.innerProperties().withId(id);
        return this;
    }

    /**
     * Get the version property: The version number associated with the source control.
     *
     * @return the version value.
     */
    public Version version() {
        return this.innerProperties() == null ? null : this.innerProperties().version();
    }

    /**
     * Set the version property: The version number associated with the source control.
     *
     * @param version the version value to set.
     * @return the SourceControlInner object itself.
     */
    public SourceControlInner withVersion(Version version) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SourceControlProperties();
        }
        this.innerProperties().withVersion(version);
        return this;
    }

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

    /**
     * Set the displayName property: The display name of the source control.
     *
     * @param displayName the displayName value to set.
     * @return the SourceControlInner object itself.
     */
    public SourceControlInner withDisplayName(String displayName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SourceControlProperties();
        }
        this.innerProperties().withDisplayName(displayName);
        return this;
    }

    /**
     * Get the description property: A description of the source control.
     *
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: A description of the source control.
     *
     * @param description the description value to set.
     * @return the SourceControlInner object itself.
     */
    public SourceControlInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SourceControlProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the repoType property: The repository type of the source control.
     *
     * @return the repoType value.
     */
    public RepoType repoType() {
        return this.innerProperties() == null ? null : this.innerProperties().repoType();
    }

    /**
     * Set the repoType property: The repository type of the source control.
     *
     * @param repoType the repoType value to set.
     * @return the SourceControlInner object itself.
     */
    public SourceControlInner withRepoType(RepoType repoType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SourceControlProperties();
        }
        this.innerProperties().withRepoType(repoType);
        return this;
    }

    /**
     * Get the contentTypes property: Array of source control content types.
     *
     * @return the contentTypes value.
     */
    public List<ContentType> contentTypes() {
        return this.innerProperties() == null ? null : this.innerProperties().contentTypes();
    }

    /**
     * Set the contentTypes property: Array of source control content types.
     *
     * @param contentTypes the contentTypes value to set.
     * @return the SourceControlInner object itself.
     */
    public SourceControlInner withContentTypes(List<ContentType> contentTypes) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SourceControlProperties();
        }
        this.innerProperties().withContentTypes(contentTypes);
        return this;
    }

    /**
     * Get the repository property: Repository metadata.
     *
     * @return the repository value.
     */
    public Repository repository() {
        return this.innerProperties() == null ? null : this.innerProperties().repository();
    }

    /**
     * Set the repository property: Repository metadata.
     *
     * @param repository the repository value to set.
     * @return the SourceControlInner object itself.
     */
    public SourceControlInner withRepository(Repository repository) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SourceControlProperties();
        }
        this.innerProperties().withRepository(repository);
        return this;
    }

    /**
     * Get the repositoryResourceInfo property: Information regarding the resources created in user's repository.
     *
     * @return the repositoryResourceInfo value.
     */
    public RepositoryResourceInfo repositoryResourceInfo() {
        return this.innerProperties() == null ? null : this.innerProperties().repositoryResourceInfo();
    }

    /**
     * Set the repositoryResourceInfo property: Information regarding the resources created in user's repository.
     *
     * @param repositoryResourceInfo the repositoryResourceInfo value to set.
     * @return the SourceControlInner object itself.
     */
    public SourceControlInner withRepositoryResourceInfo(RepositoryResourceInfo repositoryResourceInfo) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SourceControlProperties();
        }
        this.innerProperties().withRepositoryResourceInfo(repositoryResourceInfo);
        return this;
    }

    /**
     * Get the lastDeploymentInfo property: Information regarding the latest deployment for the source control.
     *
     * @return the lastDeploymentInfo value.
     */
    public DeploymentInfo lastDeploymentInfo() {
        return this.innerProperties() == null ? null : this.innerProperties().lastDeploymentInfo();
    }

    /**
     * Set the lastDeploymentInfo property: Information regarding the latest deployment for the source control.
     *
     * @param lastDeploymentInfo the lastDeploymentInfo value to set.
     * @return the SourceControlInner object itself.
     */
    public SourceControlInner withLastDeploymentInfo(DeploymentInfo lastDeploymentInfo) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SourceControlProperties();
        }
        this.innerProperties().withLastDeploymentInfo(lastDeploymentInfo);
        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();
        }
    }
}
