import { PubSubEngine } from 'type-graphql';
import { AppContext } from '../types.js';
import { ResolverBase } from './ResolverBase.js';
import { EntityInfo, AggregateResult } from '@memberjunction/core';
import { KeyValuePairOutputType } from './KeyInputOutputTypes.js';
/********************************************************************************
 * The PURPOSE of this resolver is to provide a generic way to run a view and return the results.
 * The best practice is to use the strongly typed sub-class of this resolver for each entity.
 * that way you get back strongly typed results. If you need a generic way to call a view and get
 * back the results, and have your own type checking in place, this resolver can be used.
 *
 */
/**
 * Input type for a single aggregate expression
 */
export declare class AggregateExpressionInput {
    expression: string;
    alias?: string;
}
/**
 * Output type for a single aggregate result
 */
export declare class AggregateResultOutput {
    expression: string;
    alias: string;
    value?: string;
    error?: string;
}
export declare class RunViewByIDInput {
    ViewID: string;
    ExtraFilter: string;
    OrderBy: string;
    Fields?: string[];
    UserSearchString: string;
    ExcludeUserViewRunID?: string;
    OverrideExcludeFilter?: string;
    SaveViewResults?: boolean;
    ExcludeDataFromAllPriorViewRuns?: boolean;
    IgnoreMaxRows?: boolean;
    MaxRows?: number;
    ForceAuditLog?: boolean;
    AuditLogDescription?: string;
    ResultType?: string;
    StartRow?: number;
    Aggregates?: AggregateExpressionInput[];
}
export declare class RunViewByNameInput {
    ViewName: string;
    ExtraFilter: string;
    OrderBy: string;
    Fields?: string[];
    UserSearchString: string;
    ExcludeUserViewRunID?: string;
    OverrideExcludeFilter?: string;
    SaveViewResults?: boolean;
    ExcludeDataFromAllPriorViewRuns?: boolean;
    IgnoreMaxRows?: boolean;
    MaxRows?: number;
    ForceAuditLog?: boolean;
    AuditLogDescription?: string;
    ResultType?: string;
    StartRow?: number;
    Aggregates?: AggregateExpressionInput[];
}
export declare class RunDynamicViewInput {
    EntityName: string;
    ExtraFilter: string;
    OrderBy: string;
    Fields?: string[];
    UserSearchString: string;
    ExcludeUserViewRunID?: string;
    OverrideExcludeFilter?: string;
    IgnoreMaxRows?: boolean;
    MaxRows?: number;
    ForceAuditLog?: boolean;
    AuditLogDescription?: string;
    ResultType?: string;
    StartRow?: number;
    Aggregates?: AggregateExpressionInput[];
}
export declare class RunViewGenericInput {
    ViewID?: string;
    ViewName?: string;
    EntityName?: string;
    ExtraFilter: string;
    OrderBy: string;
    Fields?: string[];
    UserSearchString: string;
    ExcludeUserViewRunID?: string;
    OverrideExcludeFilter?: string;
    SaveViewResults?: boolean;
    ExcludeDataFromAllPriorViewRuns?: boolean;
    IgnoreMaxRows?: boolean;
    MaxRows?: number;
    ForceAuditLog?: boolean;
    AuditLogDescription?: string;
    ResultType?: string;
    StartRow?: number;
    Aggregates?: AggregateExpressionInput[];
}
export declare class RunViewCacheStatusInput {
    maxUpdatedAt: string;
    rowCount: number;
}
export declare class RunViewWithCacheCheckInput {
    params: RunDynamicViewInput;
    cacheStatus?: RunViewCacheStatusInput;
}
export declare class DifferentialDataOutput {
    updatedRows: RunViewGenericResultRow[];
    deletedRecordIDs: string[];
}
export declare class RunViewWithCacheCheckResultOutput {
    viewIndex: number;
    status: string;
    Results?: RunViewGenericResultRow[];
    differentialData?: DifferentialDataOutput;
    maxUpdatedAt?: string;
    rowCount?: number;
    errorMessage?: string;
}
export declare class RunViewsWithCacheCheckOutput {
    success: boolean;
    results: RunViewWithCacheCheckResultOutput[];
    errorMessage?: string;
}
export declare class RunViewResultRow {
    PrimaryKey: KeyValuePairOutputType[];
    EntityID: string;
    Data: string;
}
export declare class RunViewGenericResultRow {
    PrimaryKey: KeyValuePairOutputType[];
    EntityID: string;
    Data: string;
}
export declare class RunViewResult {
    Results: RunViewResultRow[];
    UserViewRunID?: string;
    RowCount: number;
    TotalRowCount: number;
    ExecutionTime: number;
    ErrorMessage?: string;
    Success: boolean;
    AggregateResults?: AggregateResultOutput[];
    AggregateExecutionTime?: number;
}
export declare class RunViewGenericResult {
    Results: RunViewGenericResultRow[];
    UserViewRunID?: string;
    RowCount: number;
    TotalRowCount: number;
    ExecutionTime: number;
    ErrorMessage?: string;
    Success: boolean;
    AggregateResults?: AggregateResultOutput[];
    AggregateExecutionTime?: number;
}
export declare class RunViewResolver extends ResolverBase {
    RunViewByName(input: RunViewByNameInput, { providers, userPayload }: AppContext, pubSub: PubSubEngine): Promise<{
        Results: RunViewResultRow[];
        UserViewRunID: string;
        RowCount: number;
        TotalRowCount: number;
        ExecutionTime: number;
        Success: boolean;
        AggregateResults: AggregateResultOutput[];
        AggregateExecutionTime: number;
    }>;
    RunViewByID(input: RunViewByIDInput, { providers, userPayload }: AppContext, pubSub: PubSubEngine): Promise<{
        Results: RunViewResultRow[];
        UserViewRunID: string;
        RowCount: number;
        TotalRowCount: number;
        ExecutionTime: number;
        Success: boolean;
        AggregateResults: AggregateResultOutput[];
        AggregateExecutionTime: number;
    }>;
    RunDynamicView(input: RunDynamicViewInput, { providers, userPayload }: AppContext, pubSub: PubSubEngine): Promise<{
        Results: RunViewResultRow[];
        UserViewRunID: string;
        RowCount: number;
        TotalRowCount: number;
        ExecutionTime: number;
        Success: boolean;
        AggregateResults: AggregateResultOutput[];
        AggregateExecutionTime: number;
    }>;
    RunViews(input: (RunViewByNameInput & RunViewByIDInput & RunDynamicViewInput)[], { providers, userPayload }: AppContext, pubSub: PubSubEngine): Promise<RunViewGenericResult[]>;
    RunViewByNameSystemUser(input: RunViewByNameInput, { providers, userPayload }: AppContext, pubSub: PubSubEngine): Promise<{
        Results: any[];
        Success: boolean;
        ErrorMessage: string;
        RowCount: number;
        TotalRowCount: number;
        ExecutionTime: number;
        UserViewRunID?: undefined;
    } | {
        Results: RunViewResultRow[];
        UserViewRunID: string;
        RowCount: number;
        TotalRowCount: number;
        ExecutionTime: number;
        Success: boolean;
        ErrorMessage: string;
    }>;
    RunViewByIDSystemUser(input: RunViewByIDInput, { providers, userPayload }: AppContext, pubSub: PubSubEngine): Promise<{
        Results: any[];
        Success: boolean;
        ErrorMessage: string;
        RowCount: number;
        TotalRowCount: number;
        ExecutionTime: number;
        UserViewRunID?: undefined;
    } | {
        Results: RunViewResultRow[];
        UserViewRunID: string;
        RowCount: number;
        TotalRowCount: number;
        ExecutionTime: number;
        Success: boolean;
        ErrorMessage: string;
    }>;
    RunDynamicViewSystemUser(input: RunDynamicViewInput, { providers, userPayload }: AppContext, pubSub: PubSubEngine): Promise<{
        Results: any[];
        Success: boolean;
        ErrorMessage: string;
        RowCount: number;
        TotalRowCount: number;
        ExecutionTime: number;
        UserViewRunID?: undefined;
    } | {
        Results: RunViewResultRow[];
        UserViewRunID: string;
        RowCount: number;
        TotalRowCount: number;
        ExecutionTime: number;
        Success: boolean;
        ErrorMessage: string;
    }>;
    RunViewsSystemUser(input: (RunViewByNameInput & RunViewByIDInput & RunDynamicViewInput)[], { providers, userPayload }: AppContext, pubSub: PubSubEngine): Promise<RunViewGenericResult[]>;
    /**
     * RunViewsWithCacheCheck - Smart cache validation for batch RunViews.
     * For each view, if cacheStatus is provided, the server checks if the cache is current.
     * If current, returns status='current' with no data. If stale, returns status='stale' with fresh data.
     */
    RunViewsWithCacheCheck(input: RunViewWithCacheCheckInput[], { providers, userPayload }: AppContext): Promise<RunViewsWithCacheCheckOutput>;
    protected processRawData(rawData: any[], entityId: string, entityInfo: EntityInfo): RunViewResultRow[];
    /**
     * Transform core AggregateResult[] to GraphQL AggregateResultOutput[].
     * Converts the value to a JSON string to preserve type information across GraphQL.
     */
    protected processAggregateResults(aggregateResults: AggregateResult[] | undefined): AggregateResultOutput[] | undefined;
}
//# sourceMappingURL=RunViewResolver.d.ts.map