"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createAPIFactory = createAPIFactory;
const vscode_1 = require("../../../common/vscode");
const ext_host_command_1 = require("../vscode/ext.host.command");
function createAPIFactory(rpcProtocol, extensionService, _type) {
    const extHostCommands = rpcProtocol.get(vscode_1.ExtHostAPIIdentifier.ExtHostCommands);
    const extHostEditors = rpcProtocol.get(vscode_1.ExtHostAPIIdentifier.ExtHostEditors);
    const logger = extensionService.logger;
    const createUuid = () => Math.random();
    const sendOperationStart = (operationId, operationName) => {
        logger.warn('Method not implemented.');
    };
    const instrumentOperation = (operationName, cb, thisArg) => async (...args) => {
        const operationId = createUuid();
        try {
            return await cb.apply(thisArg, [operationId, ...args]);
        }
        catch (e) { }
    };
    const instrumentSimpleOperation = (operationName, cb, thisArg) => instrumentOperation(operationName, async (operationId, ...args) => await cb.apply(thisArg, args), thisArg);
    return (extension) => ({
        instrumentOperation,
        sendOperationStart,
        createUuid,
        instrumentSimpleOperation,
        initializeFromJsonFile(jsonFilepath, options) {
            logger.warn('Method not implemented.');
        },
        initialize(extensionId, version, aiKey, options) {
            logger.warn('Method not implemented.');
        },
        setUserError(err) {
            logger.warn('Method not implemented.');
        },
        setErrorCode(err, errorCode) {
            logger.warn('Method not implemented.');
        },
        instrumentOperationAsVsCodeCommand(command, cb, thisArg) {
            const vscodeCommands = (0, ext_host_command_1.createCommandsApiFactory)(extHostCommands, extHostEditors, extension);
            return vscodeCommands.registerCommand(command, instrumentSimpleOperation(command, cb, thisArg));
        },
        sendOperationEnd(operationId, operationName, duration, err) {
            logger.warn('Method not implemented.');
        },
        sendError(err) {
            logger.warn('Method not implemented.');
        },
        sendOperationError(operationId, operationName, err) {
            logger.warn('Method not implemented.');
        },
        sendInfo(operationId, data) {
            logger.warn('Method not implemented.');
        },
        instrumentOperationStep(operationId, stepName, cb) {
            return async (...args) => {
                try {
                    return await cb(...args);
                }
                catch (e) { }
            };
        },
        dispose() {
            logger.warn('Method not implemented.');
        },
        addContextProperty(name, value) {
            logger.warn('Method not implemented.');
        },
    });
}
//# sourceMappingURL=ext.host.api.impl.js.map