"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.gitlabTicketTrackerProvider = void 0;
const catalog_1 = require("../../i18n/catalog");
const gitlab_ticket_tracker_client_1 = require("../ticket-tracker/gitlab-ticket-tracker-client");
const auth_1 = require("./auth");
const project_ref_1 = require("./project-ref");
exports.gitlabTicketTrackerProvider = {
    kind: "gitlab",
    workflowStatePresentationFlavor: "gfm-collapsible",
    async createClient(configSlice, authProvider, locale = catalog_1.DEFAULT_APP_LOCALE) {
        const token = await authProvider.getTicketTrackerToken(configSlice);
        return new gitlab_ticket_tracker_client_1.GitLabTicketTrackerClient(configSlice, token, locale);
    },
    renderInitCompletionInstructions(configSlice, locale = catalog_1.DEFAULT_APP_LOCALE, options = {}) {
        const instructions = [
            (0, catalog_1.translate)(locale, "init.command.success.addReadyLabel", {
                label: configSlice.workflowLabels.aiReady,
            }),
        ];
        if (options.includeIssueListUrl === true) {
            const { origin, fullPath } = (0, project_ref_1.parseGitLabProjectRef)(configSlice.projectRef, locale);
            instructions.push((0, catalog_1.translate)(locale, "init.command.success.issueListUrl", {
                url: `${origin}/${fullPath}/-/issues`,
            }));
        }
        return instructions;
    },
    ...project_ref_1.gitlabProjectRefCapabilities,
    auth: auth_1.gitlabTicketTrackerAuth,
};
