"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.__tsfTypeAliases = void 0;
exports.isStructuredProvider = isStructuredProvider;
exports.getProviderToken = getProviderToken;
exports.getProviderScope = getProviderScope;
const tslib_1 = require("tslib");
const _a = tslib_1.__importStar(require("@zyno-io/ts-server-foundation/type-metadata-runtime"));
function isStructuredProvider(provider) {
    return typeof provider === 'object' && provider !== null && 'provide' in provider;
}
function getProviderToken(provider) {
    return isStructuredProvider(provider) ? provider.provide : provider;
}
function getProviderScope(provider) {
    if (!isStructuredProvider(provider))
        return 'singleton';
    if ('useValue' in provider)
        return 'singleton';
    if ('useExisting' in provider)
        return 'transient';
    const scope = 'useTargetFactory' in provider ? (provider.scope ?? 'transient') : (provider.scope ?? 'singleton');
    return scope === 'http' ? 'request' : scope;
}
exports.__tsfTypeAliases = _a.decodeCompactMetadataV1("[1,{\"ProviderScope\":{\"kind\":12,\"types\":[{\"kind\":10,\"literal\":\"singleton\"},{\"kind\":10,\"literal\":\"transient\"},{\"kind\":10,\"literal\":\"request\"},{\"kind\":10,\"literal\":\"http\"}],\"typeName\":\"ProviderScope\"}}]", []);
//# sourceMappingURL=provider.js.map