"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const MethodNotImplementedError_1 = require("../exception/MethodNotImplementedError");
const remoteApi = {
    call: {},
    watch: {},
    ref: {
        createA: (data) => {
            return {
                call: {},
                watch: {},
                ref: {},
            };
        },
    },
};
// remote process down here
class A {
    increment(n) {
        return n + 1;
    }
    watchBodyClick(callback) {
        const listener = () => {
            callback();
        };
        document.body.addEventListener('click', listener);
        return () => {
            document.body.removeEventListener('click', listener);
        };
    }
    saveUser() {
        return __awaiter(this, void 0, void 0, function* () {
            return {};
        });
    }
}
class System {
    createA() {
        const a = new A();
        return a;
    }
}
const system = new System();
window.onmessage = (event) => {
    const { data } = event;
    const { type: _type, method: _method, data: _data } = data;
    switch (_type) {
        case 'call':
        case 'watch':
        case 'ref':
    }
};
/// process A
const channel = {
    send: function (message) {
        throw new MethodNotImplementedError_1.MethodNotImplementedError();
    },
    onmessage: function (event) {
        throw new MethodNotImplementedError_1.MethodNotImplementedError();
    },
    onerror: function (event) {
        throw new MethodNotImplementedError_1.MethodNotImplementedError();
    },
    terminate: function () {
        throw new MethodNotImplementedError_1.MethodNotImplementedError();
    },
};
const remoteSystem = createAPI(`
  interface ISystem {
    createA(): A
  }
`, channel);
(() => __awaiter(void 0, void 0, void 0, function* () {
    const a = yield remoteSystem.createA();
    const result = yield a.increment(1);
}))();
function createAPI(spec, chane) {
    throw new MethodNotImplementedError_1.MethodNotImplementedError();
}
//# sourceMappingURL=RemoteAPI.js.map