(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "../core/types", "./ServiceCollection"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var types_1 = require("../core/types");
    var ServiceCollection_1 = require("./ServiceCollection");
    function Register(id, scope) {
        return function (target) {
            if (typeof id === "object") {
                if (scope) {
                    id.scope = scope;
                }
                ServiceCollection_1.ServiceCollection.instance.register(id.for || target, id.for ? function (sp) { return sp.create(target); } : null, id.scope || ServiceCollection_1.Scope.Transient, id.id);
                if (id.mockOrInject) {
                    if (id.mockOrInject.inject) {
                        types_1.DI.inject(target, id.mockOrInject.inject);
                    }
                    else if (id.mockOrInject.mock) {
                        types_1.DI.mockType(target, id.mockOrInject.mock);
                    }
                }
                return;
            }
            ServiceCollection_1.ServiceCollection.instance.register(target, null, scope, id);
        };
    }
    exports.Register = Register;
});
//# sourceMappingURL=Register.js.map