"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.injectBase = injectBase;
const error_msgs_1 = require("../constants/error_msgs");
const metadata_1 = require("../planning/metadata");
const decorator_utils_1 = require("./decorator_utils");
function injectBase(metadataKey) {
    return (serviceIdentifier) => {
        return (target, targetKey, indexOrPropertyDescriptor) => {
            if (serviceIdentifier === undefined) {
                const className = typeof target === 'function' ? target.name : target.constructor.name;
                throw new Error((0, error_msgs_1.UNDEFINED_INJECT_ANNOTATION)(className));
            }
            (0, decorator_utils_1.createTaggedDecorator)(new metadata_1.Metadata(metadataKey, serviceIdentifier))(target, targetKey, indexOrPropertyDescriptor);
        };
    };
}
