"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Semifunctional_1 = require("../../../../../Class/Semifunctional");
const evaluate_1 = require("../../../../../spec/evaluate");
const Async_1 = require("../../../../../types/interface/async/Async");
const _ids_1 = require("../../../../_ids");
class Read extends Semifunctional_1.Semifunctional {
    constructor(system) {
        super({
            fi: ['value', 'any'],
            fo: ['data'],
            o: ['done'],
        }, {
            input: {
                value: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_READ);
    }
    f({ value, any }, done, fail) {
        const { classes, specs } = this.__system;
        value = (0, Async_1.Async)(value, ['V'], this.__system.async);
        value.$read({}, (data_, err) => {
            const data = (0, evaluate_1.evaluate)(data_, specs, classes);
            if (err) {
                fail(err);
                return;
            }
            done({ data });
        });
    }
    b() {
        this._output.done.push(true);
    }
}
exports.default = Read;
//# sourceMappingURL=index.js.map