var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
import { Arg, Ctx, ObjectType, Query, Resolver, Field, Int, InputType } from 'type-graphql';
import { RunQuery, LogError } from '@memberjunction/core';
import { RequireSystemUser } from '../directives/RequireSystemUser.js';
import { GraphQLJSONObject } from 'graphql-type-json';
import { GetReadOnlyProvider } from '../util.js';
let RunQueryInput = class RunQueryInput {
    QueryID;
    QueryName;
    CategoryID;
    CategoryPath;
    Parameters;
    MaxRows;
    StartRow;
    ForceAuditLog;
    AuditLogDescription;
};
__decorate([
    Field(() => String, { nullable: true, description: 'Query ID to run - either QueryID or QueryName must be provided' }),
    __metadata("design:type", String)
], RunQueryInput.prototype, "QueryID", void 0);
__decorate([
    Field(() => String, { nullable: true, description: 'Query Name to run - either QueryID or QueryName must be provided' }),
    __metadata("design:type", String)
], RunQueryInput.prototype, "QueryName", void 0);
__decorate([
    Field(() => String, { nullable: true, description: 'Category ID to help disambiguate queries with the same name' }),
    __metadata("design:type", String)
], RunQueryInput.prototype, "CategoryID", void 0);
__decorate([
    Field(() => String, { nullable: true, description: 'Category path to help disambiguate queries with the same name' }),
    __metadata("design:type", String)
], RunQueryInput.prototype, "CategoryPath", void 0);
__decorate([
    Field(() => GraphQLJSONObject, { nullable: true, description: 'Parameters to pass to the query' }),
    __metadata("design:type", Object)
], RunQueryInput.prototype, "Parameters", void 0);
__decorate([
    Field(() => Int, { nullable: true, description: 'Maximum number of rows to return' }),
    __metadata("design:type", Number)
], RunQueryInput.prototype, "MaxRows", void 0);
__decorate([
    Field(() => Int, { nullable: true, description: 'Starting row offset for pagination' }),
    __metadata("design:type", Number)
], RunQueryInput.prototype, "StartRow", void 0);
__decorate([
    Field(() => Boolean, { nullable: true, description: 'Force audit logging regardless of query settings' }),
    __metadata("design:type", Boolean)
], RunQueryInput.prototype, "ForceAuditLog", void 0);
__decorate([
    Field(() => String, { nullable: true, description: 'Description to use in audit log' }),
    __metadata("design:type", String)
], RunQueryInput.prototype, "AuditLogDescription", void 0);
RunQueryInput = __decorate([
    InputType()
], RunQueryInput);
export { RunQueryInput };
let RunQueryResultType = class RunQueryResultType {
    QueryID;
    QueryName;
    Success;
    Results;
    RowCount;
    TotalRowCount;
    ExecutionTime;
    ErrorMessage;
    AppliedParameters;
    CacheHit;
    CacheTTLRemaining;
};
__decorate([
    Field(),
    __metadata("design:type", String)
], RunQueryResultType.prototype, "QueryID", void 0);
__decorate([
    Field(),
    __metadata("design:type", String)
], RunQueryResultType.prototype, "QueryName", void 0);
__decorate([
    Field(),
    __metadata("design:type", Boolean)
], RunQueryResultType.prototype, "Success", void 0);
__decorate([
    Field(),
    __metadata("design:type", String)
], RunQueryResultType.prototype, "Results", void 0);
__decorate([
    Field(),
    __metadata("design:type", Number)
], RunQueryResultType.prototype, "RowCount", void 0);
__decorate([
    Field(),
    __metadata("design:type", Number)
], RunQueryResultType.prototype, "TotalRowCount", void 0);
__decorate([
    Field(),
    __metadata("design:type", Number)
], RunQueryResultType.prototype, "ExecutionTime", void 0);
__decorate([
    Field(),
    __metadata("design:type", String)
], RunQueryResultType.prototype, "ErrorMessage", void 0);
__decorate([
    Field(() => String, { nullable: true }),
    __metadata("design:type", String)
], RunQueryResultType.prototype, "AppliedParameters", void 0);
__decorate([
    Field(() => Boolean, { nullable: true }),
    __metadata("design:type", Boolean)
], RunQueryResultType.prototype, "CacheHit", void 0);
__decorate([
    Field(() => Int, { nullable: true }),
    __metadata("design:type", Number)
], RunQueryResultType.prototype, "CacheTTLRemaining", void 0);
RunQueryResultType = __decorate([
    ObjectType()
], RunQueryResultType);
export { RunQueryResultType };
let RunQueryCacheStatusInput = class RunQueryCacheStatusInput {
    maxUpdatedAt;
    rowCount;
};
__decorate([
    Field(() => String, { description: 'The maximum __mj_UpdatedAt value from cached results' }),
    __metadata("design:type", String)
], RunQueryCacheStatusInput.prototype, "maxUpdatedAt", void 0);
__decorate([
    Field(() => Int, { description: 'The number of rows in cached results' }),
    __metadata("design:type", Number)
], RunQueryCacheStatusInput.prototype, "rowCount", void 0);
RunQueryCacheStatusInput = __decorate([
    InputType()
], RunQueryCacheStatusInput);
export { RunQueryCacheStatusInput };
let RunQueryWithCacheCheckInput = class RunQueryWithCacheCheckInput {
    params;
    cacheStatus;
};
__decorate([
    Field(() => RunQueryInput, { description: 'The RunQuery parameters' }),
    __metadata("design:type", RunQueryInput)
], RunQueryWithCacheCheckInput.prototype, "params", void 0);
__decorate([
    Field(() => RunQueryCacheStatusInput, {
        nullable: true,
        description: 'Optional cache status - if provided, server will check if cache is current'
    }),
    __metadata("design:type", RunQueryCacheStatusInput)
], RunQueryWithCacheCheckInput.prototype, "cacheStatus", void 0);
RunQueryWithCacheCheckInput = __decorate([
    InputType()
], RunQueryWithCacheCheckInput);
export { RunQueryWithCacheCheckInput };
let RunQueryWithCacheCheckResultOutput = class RunQueryWithCacheCheckResultOutput {
    queryIndex;
    queryId;
    status;
    Results;
    maxUpdatedAt;
    rowCount;
    errorMessage;
};
__decorate([
    Field(() => Int, { description: 'The index of this query in the batch request' }),
    __metadata("design:type", Number)
], RunQueryWithCacheCheckResultOutput.prototype, "queryIndex", void 0);
__decorate([
    Field(() => String, { description: 'The query ID' }),
    __metadata("design:type", String)
], RunQueryWithCacheCheckResultOutput.prototype, "queryId", void 0);
__decorate([
    Field(() => String, { description: "'current', 'stale', 'no_validation', or 'error'" }),
    __metadata("design:type", String)
], RunQueryWithCacheCheckResultOutput.prototype, "status", void 0);
__decorate([
    Field(() => String, {
        nullable: true,
        description: 'JSON-stringified results - only populated when status is stale or no_validation'
    }),
    __metadata("design:type", String)
], RunQueryWithCacheCheckResultOutput.prototype, "Results", void 0);
__decorate([
    Field(() => String, { nullable: true, description: 'Max __mj_UpdatedAt from results when stale' }),
    __metadata("design:type", String)
], RunQueryWithCacheCheckResultOutput.prototype, "maxUpdatedAt", void 0);
__decorate([
    Field(() => Int, { nullable: true, description: 'Row count of results when stale' }),
    __metadata("design:type", Number)
], RunQueryWithCacheCheckResultOutput.prototype, "rowCount", void 0);
__decorate([
    Field(() => String, { nullable: true, description: 'Error message if status is error' }),
    __metadata("design:type", String)
], RunQueryWithCacheCheckResultOutput.prototype, "errorMessage", void 0);
RunQueryWithCacheCheckResultOutput = __decorate([
    ObjectType()
], RunQueryWithCacheCheckResultOutput);
export { RunQueryWithCacheCheckResultOutput };
let RunQueriesWithCacheCheckOutput = class RunQueriesWithCacheCheckOutput {
    success;
    results;
    errorMessage;
};
__decorate([
    Field(() => Boolean, { description: 'Whether the overall operation succeeded' }),
    __metadata("design:type", Boolean)
], RunQueriesWithCacheCheckOutput.prototype, "success", void 0);
__decorate([
    Field(() => [RunQueryWithCacheCheckResultOutput], { description: 'Results for each query in the batch' }),
    __metadata("design:type", Array)
], RunQueriesWithCacheCheckOutput.prototype, "results", void 0);
__decorate([
    Field(() => String, { nullable: true, description: 'Overall error message if success is false' }),
    __metadata("design:type", String)
], RunQueriesWithCacheCheckOutput.prototype, "errorMessage", void 0);
RunQueriesWithCacheCheckOutput = __decorate([
    ObjectType()
], RunQueriesWithCacheCheckOutput);
export { RunQueriesWithCacheCheckOutput };
let RunQueryResolver = class RunQueryResolver {
    async findQuery(md, QueryID, QueryName, CategoryID, CategoryPath, refreshMetadataIfNotFound = false) {
        const queries = md.Queries.filter(q => {
            if (QueryID) {
                return q.ID.trim().toLowerCase() === QueryID.trim().toLowerCase();
            }
            else if (QueryName) {
                let matches = q.Name.trim().toLowerCase() === QueryName.trim().toLowerCase();
                if (CategoryID) {
                    matches = matches && q.CategoryID?.trim().toLowerCase() === CategoryID.trim().toLowerCase();
                }
                if (CategoryPath) {
                    matches = matches && q.Category?.trim().toLowerCase() === CategoryPath.trim().toLowerCase();
                }
                return matches;
            }
            return false;
        });
        if (queries.length === 0) {
            if (refreshMetadataIfNotFound) {
                await md.Refresh();
                return this.findQuery(md, QueryID, QueryName, CategoryID, CategoryPath, false);
            }
            else {
                return null;
            }
        }
        else {
            return queries[0];
        }
    }
    async GetQueryData(QueryID, context, CategoryID, CategoryPath, Parameters, MaxRows, StartRow, ForceAuditLog, AuditLogDescription) {
        const provider = GetReadOnlyProvider(context.providers, { allowFallbackToReadWrite: true });
        const md = provider;
        const rq = new RunQuery(provider);
        console.log('GetQueryData called with:', { QueryID, Parameters, MaxRows, StartRow, ForceAuditLog, AuditLogDescription });
        const result = await rq.RunQuery({
            QueryID: QueryID,
            CategoryID: CategoryID,
            CategoryPath: CategoryPath,
            Parameters: Parameters,
            MaxRows: MaxRows,
            StartRow: StartRow,
            ForceAuditLog: ForceAuditLog,
            AuditLogDescription: AuditLogDescription
        }, context.userPayload.userRecord);
        console.log('RunQuery result:', {
            Success: result.Success,
            ErrorMessage: result.ErrorMessage,
            AppliedParameters: result.AppliedParameters
        });
        let queryName = result.QueryName;
        if (!queryName) {
            try {
                const queryInfo = await this.findQuery(md, QueryID, undefined, CategoryID, CategoryPath, true);
                if (queryInfo) {
                    queryName = queryInfo.Name;
                }
            }
            catch (error) {
                console.error('Error finding query to get name:', error);
            }
        }
        return {
            QueryID: QueryID,
            QueryName: queryName || 'Unknown Query',
            Success: result.Success ?? false,
            Results: JSON.stringify(result.Results ?? null),
            RowCount: result.RowCount ?? 0,
            TotalRowCount: result.TotalRowCount ?? 0,
            ExecutionTime: result.ExecutionTime ?? 0,
            ErrorMessage: result.ErrorMessage || '',
            AppliedParameters: result.AppliedParameters ? JSON.stringify(result.AppliedParameters) : undefined,
            CacheHit: result.CacheHit,
            CacheTTLRemaining: result.CacheTTLRemaining
        };
    }
    async GetQueryDataByName(QueryName, context, CategoryID, CategoryPath, Parameters, MaxRows, StartRow, ForceAuditLog, AuditLogDescription) {
        const provider = GetReadOnlyProvider(context.providers, { allowFallbackToReadWrite: true });
        const rq = new RunQuery(provider);
        const result = await rq.RunQuery({
            QueryName: QueryName,
            CategoryID: CategoryID,
            CategoryPath: CategoryPath,
            Parameters: Parameters,
            MaxRows: MaxRows,
            StartRow: StartRow,
            ForceAuditLog: ForceAuditLog,
            AuditLogDescription: AuditLogDescription
        }, context.userPayload.userRecord);
        return {
            QueryID: result.QueryID || '',
            QueryName: QueryName,
            Success: result.Success ?? false,
            Results: JSON.stringify(result.Results ?? null),
            RowCount: result.RowCount ?? 0,
            TotalRowCount: result.TotalRowCount ?? 0,
            ExecutionTime: result.ExecutionTime ?? 0,
            ErrorMessage: result.ErrorMessage || '',
            AppliedParameters: result.AppliedParameters ? JSON.stringify(result.AppliedParameters) : undefined,
            CacheHit: result.CacheHit,
            CacheTTLRemaining: result.CacheTTLRemaining
        };
    }
    async GetQueryDataSystemUser(QueryID, context, CategoryID, CategoryPath, Parameters, MaxRows, StartRow, ForceAuditLog, AuditLogDescription) {
        const provider = GetReadOnlyProvider(context.providers, { allowFallbackToReadWrite: true });
        const md = provider;
        const rq = new RunQuery(provider);
        const result = await rq.RunQuery({
            QueryID: QueryID,
            CategoryID: CategoryID,
            CategoryPath: CategoryPath,
            Parameters: Parameters,
            MaxRows: MaxRows,
            StartRow: StartRow,
            ForceAuditLog: ForceAuditLog,
            AuditLogDescription: AuditLogDescription
        }, context.userPayload.userRecord);
        let queryName = result.QueryName;
        if (!queryName) {
            try {
                const queryInfo = await this.findQuery(md, QueryID, undefined, CategoryID, CategoryPath, true);
                if (queryInfo) {
                    queryName = queryInfo.Name;
                }
            }
            catch (error) {
                console.error('Error finding query to get name:', error);
            }
        }
        return {
            QueryID: QueryID,
            QueryName: queryName || 'Unknown Query',
            Success: result.Success ?? false,
            Results: JSON.stringify(result.Results ?? null),
            RowCount: result.RowCount ?? 0,
            TotalRowCount: result.TotalRowCount ?? 0,
            ExecutionTime: result.ExecutionTime ?? 0,
            ErrorMessage: result.ErrorMessage || '',
            AppliedParameters: result.AppliedParameters ? JSON.stringify(result.AppliedParameters) : undefined,
            CacheHit: result.CacheHit,
            CacheTTLRemaining: result.CacheTTLRemaining
        };
    }
    async GetQueryDataByNameSystemUser(QueryName, context, CategoryID, CategoryPath, Parameters, MaxRows, StartRow, ForceAuditLog, AuditLogDescription) {
        const provider = GetReadOnlyProvider(context.providers, { allowFallbackToReadWrite: true });
        const rq = new RunQuery(provider);
        const result = await rq.RunQuery({
            QueryName: QueryName,
            CategoryID: CategoryID,
            CategoryPath: CategoryPath,
            Parameters: Parameters,
            MaxRows: MaxRows,
            StartRow: StartRow,
            ForceAuditLog: ForceAuditLog,
            AuditLogDescription: AuditLogDescription
        }, context.userPayload.userRecord);
        return {
            QueryID: result.QueryID || '',
            QueryName: QueryName,
            Success: result.Success ?? false,
            Results: JSON.stringify(result.Results ?? null),
            RowCount: result.RowCount ?? 0,
            TotalRowCount: result.TotalRowCount ?? 0,
            ExecutionTime: result.ExecutionTime ?? 0,
            ErrorMessage: result.ErrorMessage || '',
            AppliedParameters: result.AppliedParameters ? JSON.stringify(result.AppliedParameters) : undefined,
            CacheHit: result.CacheHit,
            CacheTTLRemaining: result.CacheTTLRemaining
        };
    }
    async RunQueries(input, context) {
        const provider = GetReadOnlyProvider(context.providers, { allowFallbackToReadWrite: true });
        const rq = new RunQuery(provider);
        const params = input.map(i => ({
            QueryID: i.QueryID,
            QueryName: i.QueryName,
            CategoryID: i.CategoryID,
            CategoryPath: i.CategoryPath,
            Parameters: i.Parameters,
            MaxRows: i.MaxRows,
            StartRow: i.StartRow,
            ForceAuditLog: i.ForceAuditLog,
            AuditLogDescription: i.AuditLogDescription
        }));
        const results = await rq.RunQueries(params, context.userPayload.userRecord);
        return results.map((result, index) => {
            const inputItem = input[index];
            return {
                QueryID: result.QueryID || inputItem.QueryID || '',
                QueryName: result.QueryName || inputItem.QueryName || 'Unknown Query',
                Success: result.Success ?? false,
                Results: JSON.stringify(result.Results ?? null),
                RowCount: result.RowCount ?? 0,
                TotalRowCount: result.TotalRowCount ?? 0,
                ExecutionTime: result.ExecutionTime ?? 0,
                ErrorMessage: result.ErrorMessage || '',
                AppliedParameters: result.AppliedParameters ? JSON.stringify(result.AppliedParameters) : undefined,
                CacheHit: result.CacheHit,
                CacheTTLRemaining: result.CacheTTLRemaining
            };
        });
    }
    async RunQueriesSystemUser(input, context) {
        const provider = GetReadOnlyProvider(context.providers, { allowFallbackToReadWrite: true });
        const rq = new RunQuery(provider);
        const params = input.map(i => ({
            QueryID: i.QueryID,
            QueryName: i.QueryName,
            CategoryID: i.CategoryID,
            CategoryPath: i.CategoryPath,
            Parameters: i.Parameters,
            MaxRows: i.MaxRows,
            StartRow: i.StartRow,
            ForceAuditLog: i.ForceAuditLog,
            AuditLogDescription: i.AuditLogDescription
        }));
        const results = await rq.RunQueries(params, context.userPayload.userRecord);
        return results.map((result, index) => {
            const inputItem = input[index];
            return {
                QueryID: result.QueryID || inputItem.QueryID || '',
                QueryName: result.QueryName || inputItem.QueryName || 'Unknown Query',
                Success: result.Success ?? false,
                Results: JSON.stringify(result.Results ?? null),
                RowCount: result.RowCount ?? 0,
                TotalRowCount: result.TotalRowCount ?? 0,
                ExecutionTime: result.ExecutionTime ?? 0,
                ErrorMessage: result.ErrorMessage || '',
                AppliedParameters: result.AppliedParameters ? JSON.stringify(result.AppliedParameters) : undefined,
                CacheHit: result.CacheHit,
                CacheTTLRemaining: result.CacheTTLRemaining
            };
        });
    }
    async RunQueriesWithCacheCheck(input, context) {
        try {
            const provider = GetReadOnlyProvider(context.providers, { allowFallbackToReadWrite: true });
            const sqlProvider = provider;
            if (!sqlProvider.RunQueriesWithCacheCheck) {
                throw new Error('Provider does not support RunQueriesWithCacheCheck');
            }
            const coreParams = input.map(item => ({
                params: {
                    QueryID: item.params.QueryID,
                    QueryName: item.params.QueryName,
                    CategoryID: item.params.CategoryID,
                    CategoryPath: item.params.CategoryPath,
                    Parameters: item.params.Parameters,
                    MaxRows: item.params.MaxRows,
                    StartRow: item.params.StartRow,
                    ForceAuditLog: item.params.ForceAuditLog,
                    AuditLogDescription: item.params.AuditLogDescription,
                },
                cacheStatus: item.cacheStatus ? {
                    maxUpdatedAt: item.cacheStatus.maxUpdatedAt,
                    rowCount: item.cacheStatus.rowCount,
                } : undefined,
            }));
            const response = await sqlProvider.RunQueriesWithCacheCheck(coreParams, context.userPayload.userRecord);
            const transformedResults = response.results.map(result => ({
                queryIndex: result.queryIndex,
                queryId: result.queryId,
                status: result.status,
                Results: result.results ? JSON.stringify(result.results) : undefined,
                maxUpdatedAt: result.maxUpdatedAt,
                rowCount: result.rowCount,
                errorMessage: result.errorMessage,
            }));
            return {
                success: response.success,
                results: transformedResults,
                errorMessage: response.errorMessage,
            };
        }
        catch (err) {
            const errorMessage = err instanceof Error ? err.message : 'Unknown error occurred';
            LogError(err);
            return {
                success: false,
                results: [],
                errorMessage,
            };
        }
    }
    async RunQueriesWithCacheCheckSystemUser(input, context) {
        return this.RunQueriesWithCacheCheck(input, context);
    }
};
__decorate([
    Query(() => RunQueryResultType),
    __param(0, Arg('QueryID', () => String)),
    __param(1, Ctx()),
    __param(2, Arg('CategoryID', () => String, { nullable: true })),
    __param(3, Arg('CategoryPath', () => String, { nullable: true })),
    __param(4, Arg('Parameters', () => GraphQLJSONObject, { nullable: true })),
    __param(5, Arg('MaxRows', () => Int, { nullable: true })),
    __param(6, Arg('StartRow', () => Int, { nullable: true })),
    __param(7, Arg('ForceAuditLog', () => Boolean, { nullable: true })),
    __param(8, Arg('AuditLogDescription', () => String, { nullable: true })),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object, String, String, Object, Number, Number, Boolean, String]),
    __metadata("design:returntype", Promise)
], RunQueryResolver.prototype, "GetQueryData", null);
__decorate([
    Query(() => RunQueryResultType),
    __param(0, Arg('QueryName', () => String)),
    __param(1, Ctx()),
    __param(2, Arg('CategoryID', () => String, { nullable: true })),
    __param(3, Arg('CategoryPath', () => String, { nullable: true })),
    __param(4, Arg('Parameters', () => GraphQLJSONObject, { nullable: true })),
    __param(5, Arg('MaxRows', () => Int, { nullable: true })),
    __param(6, Arg('StartRow', () => Int, { nullable: true })),
    __param(7, Arg('ForceAuditLog', () => Boolean, { nullable: true })),
    __param(8, Arg('AuditLogDescription', () => String, { nullable: true })),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object, String, String, Object, Number, Number, Boolean, String]),
    __metadata("design:returntype", Promise)
], RunQueryResolver.prototype, "GetQueryDataByName", null);
__decorate([
    RequireSystemUser(),
    Query(() => RunQueryResultType),
    __param(0, Arg('QueryID', () => String)),
    __param(1, Ctx()),
    __param(2, Arg('CategoryID', () => String, { nullable: true })),
    __param(3, Arg('CategoryPath', () => String, { nullable: true })),
    __param(4, Arg('Parameters', () => GraphQLJSONObject, { nullable: true })),
    __param(5, Arg('MaxRows', () => Int, { nullable: true })),
    __param(6, Arg('StartRow', () => Int, { nullable: true })),
    __param(7, Arg('ForceAuditLog', () => Boolean, { nullable: true })),
    __param(8, Arg('AuditLogDescription', () => String, { nullable: true })),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object, String, String, Object, Number, Number, Boolean, String]),
    __metadata("design:returntype", Promise)
], RunQueryResolver.prototype, "GetQueryDataSystemUser", null);
__decorate([
    RequireSystemUser(),
    Query(() => RunQueryResultType),
    __param(0, Arg('QueryName', () => String)),
    __param(1, Ctx()),
    __param(2, Arg('CategoryID', () => String, { nullable: true })),
    __param(3, Arg('CategoryPath', () => String, { nullable: true })),
    __param(4, Arg('Parameters', () => GraphQLJSONObject, { nullable: true })),
    __param(5, Arg('MaxRows', () => Int, { nullable: true })),
    __param(6, Arg('StartRow', () => Int, { nullable: true })),
    __param(7, Arg('ForceAuditLog', () => Boolean, { nullable: true })),
    __param(8, Arg('AuditLogDescription', () => String, { nullable: true })),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object, String, String, Object, Number, Number, Boolean, String]),
    __metadata("design:returntype", Promise)
], RunQueryResolver.prototype, "GetQueryDataByNameSystemUser", null);
__decorate([
    Query(() => [RunQueryResultType]),
    __param(0, Arg('input', () => [RunQueryInput])),
    __param(1, Ctx()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Array, Object]),
    __metadata("design:returntype", Promise)
], RunQueryResolver.prototype, "RunQueries", null);
__decorate([
    RequireSystemUser(),
    Query(() => [RunQueryResultType]),
    __param(0, Arg('input', () => [RunQueryInput])),
    __param(1, Ctx()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Array, Object]),
    __metadata("design:returntype", Promise)
], RunQueryResolver.prototype, "RunQueriesSystemUser", null);
__decorate([
    Query(() => RunQueriesWithCacheCheckOutput),
    __param(0, Arg('input', () => [RunQueryWithCacheCheckInput])),
    __param(1, Ctx()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Array, Object]),
    __metadata("design:returntype", Promise)
], RunQueryResolver.prototype, "RunQueriesWithCacheCheck", null);
__decorate([
    RequireSystemUser(),
    Query(() => RunQueriesWithCacheCheckOutput),
    __param(0, Arg('input', () => [RunQueryWithCacheCheckInput])),
    __param(1, Ctx()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Array, Object]),
    __metadata("design:returntype", Promise)
], RunQueryResolver.prototype, "RunQueriesWithCacheCheckSystemUser", null);
RunQueryResolver = __decorate([
    Resolver()
], RunQueryResolver);
export { RunQueryResolver };
//# sourceMappingURL=QueryResolver.js.map