"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Getter = void 0;
const Async_1 = require("../../types/interface/async/Async");
const Functional_1 = require("../Functional");
class Getter extends Functional_1.Functional {
    constructor({ i, o, $i, $o, $m, $_, }, opt = {}, system, id) {
        super({ i, o }, opt, system, id);
        this.$$i = $i;
        this.$$o = $o;
        this.$$m = $m;
        this.$$_ = $_;
    }
    opt(i) {
        return {};
    }
    f(i, done, fail) {
        let obj = i[this.$$i];
        obj = (0, Async_1.Async)(obj, this.$$_, this.__system.async);
        const opt = this.opt(i);
        obj[`$${this.$$m}`](opt, (data, err) => {
            if (err) {
                fail(err);
                return;
            }
            done({ [this.$$o]: data });
        });
    }
}
exports.Getter = Getter;
//# sourceMappingURL=index.js.map