export var RepositoryEntityType;
(function (RepositoryEntityType) {
    RepositoryEntityType["APPLICATION"] = "application";
    RepositoryEntityType["WORKFLOW"] = "workflow";
    RepositoryEntityType["SCHEDULED_JOB"] = "scheduled_job";
})(RepositoryEntityType || (RepositoryEntityType = {}));
export var VcsProvider;
(function (VcsProvider) {
    VcsProvider["GITHUB"] = "github";
    VcsProvider["GITLAB"] = "gitlab";
    VcsProvider["AZURE_DEVOPS"] = "azure_devops";
})(VcsProvider || (VcsProvider = {}));
export const getGitProviderBaseUrl = (provider, token) => {
    switch (provider) {
        case VcsProvider.GITLAB: {
            if (token?.instanceUrl)
                return token.instanceUrl;
            return 'https://gitlab.com';
        }
        case VcsProvider.AZURE_DEVOPS: {
            return 'https://dev.azure.com';
        }
        case VcsProvider.GITHUB:
        default: {
            return 'https://github.com';
        }
    }
};
export const getRepositoryUrl = (repository, token) => {
    const baseUrl = getGitProviderBaseUrl(repository.provider, token);
    if (repository.provider === VcsProvider.AZURE_DEVOPS) {
        // Azure DevOps URL format: https://dev.azure.com/{organization}/{project}/_git/{repo}
        return `${baseUrl}/${repository.owner}/_git/${repository.name}`;
    }
    return `${baseUrl}/${repository.owner}/${repository.name}`;
};
//# sourceMappingURL=index.js.map