"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TerminalContributionPoint = void 0;
const tslib_1 = require("tslib");
const di_1 = require("@opensumi/di");
const ide_core_common_1 = require("@opensumi/ide-core-common");
const common_1 = require("@opensumi/ide-terminal-next/lib/common");
const common_2 = require("../../../common");
let TerminalContributionPoint = class TerminalContributionPoint extends common_2.VSCodeContributePoint {
    contribute() {
        for (const contrib of this.contributesMap) {
            const { extensionId, contributes } = contrib;
            this.profileService.addContributedProfile(extensionId, contributes);
        }
    }
    dispose() {
        for (const contrib of this.contributesMap) {
            const { extensionId } = contrib;
            this.profileService.removeContributedProfile(extensionId);
        }
    }
};
exports.TerminalContributionPoint = TerminalContributionPoint;
TerminalContributionPoint.schema = {
    description: (0, ide_core_common_1.localize)('vscode.extension.contributes.terminal', 'Contributes terminal functionality.'),
    type: 'object',
    properties: {
        types: {
            type: 'array',
            description: (0, ide_core_common_1.localize)('vscode.extension.contributes.terminal.types', 'Defines additional terminal types that the user can create.'),
            items: {
                type: 'object',
                required: ['command', 'title'],
                properties: {
                    command: {
                        description: (0, ide_core_common_1.localize)('vscode.extension.contributes.terminal.types.command', 'Command to execute when the user creates this type of terminal.'),
                        type: 'string',
                    },
                    title: {
                        description: (0, ide_core_common_1.localize)('vscode.extension.contributes.terminal.types.title', 'Title for this type of terminal.'),
                        type: 'string',
                    },
                    icon: {
                        description: (0, ide_core_common_1.localize)('vscode.extension.contributes.terminal.types.icon', 'A codicon, URI, or light and dark URIs to associate with this terminal type.'),
                        anyOf: [
                            {
                                type: 'string',
                            },
                            {
                                type: 'object',
                                properties: {
                                    light: {
                                        description: (0, ide_core_common_1.localize)('vscode.extension.contributes.terminal.types.icon.light', 'Icon path when a light theme is used'),
                                        type: 'string',
                                    },
                                    dark: {
                                        description: (0, ide_core_common_1.localize)('vscode.extension.contributes.terminal.types.icon.dark', 'Icon path when a dark theme is used'),
                                        type: 'string',
                                    },
                                },
                            },
                        ],
                    },
                },
            },
        },
        profiles: {
            type: 'array',
            description: (0, ide_core_common_1.localize)('vscode.extension.contributes.terminal.profiles', 'Defines additional terminal profiles that the user can create.'),
            items: {
                type: 'object',
                required: ['id', 'title'],
                defaultSnippets: [
                    {
                        body: {
                            id: '$1',
                            title: '$2',
                        },
                    },
                ],
                properties: {
                    id: {
                        description: (0, ide_core_common_1.localize)('vscode.extension.contributes.terminal.profiles.id', 'The ID of the terminal profile provider.'),
                        type: 'string',
                    },
                    title: {
                        description: (0, ide_core_common_1.localize)('vscode.extension.contributes.terminal.profiles.title', 'Title for this terminal profile.'),
                        type: 'string',
                    },
                    icon: {
                        description: (0, ide_core_common_1.localize)('vscode.extension.contributes.terminal.types.icon', 'A codicon, URI, or light and dark URIs to associate with this terminal type.'),
                        anyOf: [
                            {
                                type: 'string',
                            },
                            {
                                type: 'object',
                                properties: {
                                    light: {
                                        description: (0, ide_core_common_1.localize)('vscode.extension.contributes.terminal.types.icon.light', 'Icon path when a light theme is used'),
                                        type: 'string',
                                    },
                                    dark: {
                                        description: (0, ide_core_common_1.localize)('vscode.extension.contributes.terminal.types.icon.dark', 'Icon path when a dark theme is used'),
                                        type: 'string',
                                    },
                                },
                            },
                        ],
                    },
                },
            },
        },
    },
};
tslib_1.__decorate([
    (0, di_1.Autowired)(common_1.ITerminalProfileService),
    tslib_1.__metadata("design:type", Object)
], TerminalContributionPoint.prototype, "profileService", void 0);
exports.TerminalContributionPoint = TerminalContributionPoint = tslib_1.__decorate([
    (0, di_1.Injectable)(),
    (0, common_2.Contributes)("terminal" /* ExtensionContributePoint.Terminal */),
    (0, common_2.LifeCycle)(4 /* LifeCyclePhase.Ready */)
], TerminalContributionPoint);
//# sourceMappingURL=terminal.js.map