// 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.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** metadata of a repository. */
@Fluent
public final class Repository {
    /*
     * Url of repository.
     */
    @JsonProperty(value = "url")
    private String url;

    /*
     * Branch name of repository.
     */
    @JsonProperty(value = "branch")
    private String branch;

    /*
     * Display url of repository.
     */
    @JsonProperty(value = "displayUrl")
    private String displayUrl;

    /*
     * Url to access repository action logs.
     */
    @JsonProperty(value = "deploymentLogsUrl")
    private String deploymentLogsUrl;

    /*
     * Dictionary of source control content type and path mapping.
     */
    @JsonProperty(value = "pathMapping")
    private List<ContentPathMap> pathMapping;

    /**
     * Get the url property: Url of repository.
     *
     * @return the url value.
     */
    public String url() {
        return this.url;
    }

    /**
     * Set the url property: Url of repository.
     *
     * @param url the url value to set.
     * @return the Repository object itself.
     */
    public Repository withUrl(String url) {
        this.url = url;
        return this;
    }

    /**
     * Get the branch property: Branch name of repository.
     *
     * @return the branch value.
     */
    public String branch() {
        return this.branch;
    }

    /**
     * Set the branch property: Branch name of repository.
     *
     * @param branch the branch value to set.
     * @return the Repository object itself.
     */
    public Repository withBranch(String branch) {
        this.branch = branch;
        return this;
    }

    /**
     * Get the displayUrl property: Display url of repository.
     *
     * @return the displayUrl value.
     */
    public String displayUrl() {
        return this.displayUrl;
    }

    /**
     * Set the displayUrl property: Display url of repository.
     *
     * @param displayUrl the displayUrl value to set.
     * @return the Repository object itself.
     */
    public Repository withDisplayUrl(String displayUrl) {
        this.displayUrl = displayUrl;
        return this;
    }

    /**
     * Get the deploymentLogsUrl property: Url to access repository action logs.
     *
     * @return the deploymentLogsUrl value.
     */
    public String deploymentLogsUrl() {
        return this.deploymentLogsUrl;
    }

    /**
     * Set the deploymentLogsUrl property: Url to access repository action logs.
     *
     * @param deploymentLogsUrl the deploymentLogsUrl value to set.
     * @return the Repository object itself.
     */
    public Repository withDeploymentLogsUrl(String deploymentLogsUrl) {
        this.deploymentLogsUrl = deploymentLogsUrl;
        return this;
    }

    /**
     * Get the pathMapping property: Dictionary of source control content type and path mapping.
     *
     * @return the pathMapping value.
     */
    public List<ContentPathMap> pathMapping() {
        return this.pathMapping;
    }

    /**
     * Set the pathMapping property: Dictionary of source control content type and path mapping.
     *
     * @param pathMapping the pathMapping value to set.
     * @return the Repository object itself.
     */
    public Repository withPathMapping(List<ContentPathMap> pathMapping) {
        this.pathMapping = pathMapping;
        return this;
    }

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