"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.giteaTicketTrackerProvider = void 0;
const catalog_1 = require("../../i18n/catalog");
const gitea_ticket_tracker_client_1 = require("../ticket-tracker/gitea-ticket-tracker-client");
const auth_1 = require("./auth");
const project_ref_1 = require("./project-ref");
exports.giteaTicketTrackerProvider = {
    kind: "gitea",
    workflowStatePresentationFlavor: "gfm-collapsible",
    async createClient(configSlice, authProvider, locale = catalog_1.DEFAULT_APP_LOCALE) {
        const credential = await authProvider.getTicketTrackerToken(configSlice);
        return new gitea_ticket_tracker_client_1.GiteaTicketTrackerClient(configSlice, credential, 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, owner, repo } = (0, project_ref_1.parseGiteaProjectRef)(configSlice.projectRef, locale);
            instructions.push((0, catalog_1.translate)(locale, "init.command.success.issueListUrl", {
                url: `${origin}/${owner}/${repo}/issues`,
            }));
        }
        return instructions;
    },
    ...project_ref_1.giteaProjectRefCapabilities,
    auth: auth_1.giteaTicketTrackerAuth,
};
