"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Holder_1 = require("../../../../Class/Holder");
const Async_1 = require("../../../../types/interface/async/Async");
const _ids_1 = require("../../../_ids");
class Pin_ extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['unit', 'name', 'type'],
            fo: ['pin'],
            i: [],
            o: ['done'],
        }, {
            input: {
                unit: {
                    ref: true,
                },
            },
            output: {
                pin: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_PIN);
    }
    async f({ unit, name, type }, done, fail) {
        unit = (0, Async_1.Async)(unit, ['U'], this.__system.async);
        try {
            const pin = unit.$refPin({ type, pinId: name });
            done({ pin });
        }
        catch (err) {
            fail(err.message);
        }
    }
    b() {
        this._output.done.push(true);
    }
}
exports.default = Pin_;
//# sourceMappingURL=index.js.map