"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRepositoryUrl = exports.getGitProviderBaseUrl = exports.VcsProvider = exports.RepositoryEntityType = void 0;
var RepositoryEntityType;
(function (RepositoryEntityType) {
    RepositoryEntityType["APPLICATION"] = "application";
    RepositoryEntityType["WORKFLOW"] = "workflow";
    RepositoryEntityType["SCHEDULED_JOB"] = "scheduled_job";
})(RepositoryEntityType || (exports.RepositoryEntityType = RepositoryEntityType = {}));
var VcsProvider;
(function (VcsProvider) {
    VcsProvider["GITHUB"] = "github";
    VcsProvider["GITLAB"] = "gitlab";
})(VcsProvider || (exports.VcsProvider = VcsProvider = {}));
const getGitProviderBaseUrl = (provider, token) => {
    switch (provider) {
        case VcsProvider.GITLAB: {
            if (token?.instanceUrl)
                return token.instanceUrl;
            return 'https://gitlab.com';
        }
        case VcsProvider.GITHUB:
        default: {
            return 'https://github.com';
        }
    }
};
exports.getGitProviderBaseUrl = getGitProviderBaseUrl;
const getRepositoryUrl = (repository, token) => {
    const baseUrl = (0, exports.getGitProviderBaseUrl)(repository.provider, token);
    return `${baseUrl}/${repository.owner}/${repository.name}`;
};
exports.getRepositoryUrl = getRepositoryUrl;
//# sourceMappingURL=index.js.map