"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.githubTicketTrackerProvider = void 0;
const catalog_1 = require("../../i18n/catalog");
const octokit_github_ticket_tracker_client_1 = require("../ticket-tracker/octokit-github-ticket-tracker-client");
const auth_1 = require("./auth");
const octokit_loader_1 = require("./octokit-loader");
const project_ref_1 = require("./project-ref");
exports.githubTicketTrackerProvider = {
    kind: "github",
    workflowStatePresentationFlavor: "gfm-collapsible",
    async createClient(configSlice, authProvider, locale = catalog_1.DEFAULT_APP_LOCALE) {
        const token = await authProvider.getTicketTrackerToken(configSlice);
        const octokit = await (0, octokit_loader_1.createGitHubOctokit)({ auth: token });
        return new octokit_github_ticket_tracker_client_1.OctokitGitHubTicketTrackerClient(configSlice, octokit, 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 { owner, repo } = (0, project_ref_1.parseGitHubProjectRef)(configSlice.projectRef, locale);
            instructions.push((0, catalog_1.translate)(locale, "init.command.success.issueListUrl", {
                url: `https://github.com/${owner}/${repo}/issues`,
            }));
        }
        return instructions;
    },
    ...project_ref_1.githubProjectRefCapabilities,
    auth: auth_1.githubTicketTrackerAuth,
};
