import { PubSubEngine } from 'type-graphql';
import { AppContext } from '../types.js';
import { UserInfo, DatabaseProviderBase } from '@memberjunction/core';
import { MJQueryResolver } from '../generated/generated.js';
import { DeleteOptionsInput } from '../generic/DeleteOptionsInput.js';
/**
 * Query status enumeration for GraphQL
 */
export declare enum QueryStatus {
    Pending = "Pending",
    Approved = "Approved",
    Rejected = "Rejected",
    Expired = "Expired"
}
export declare class QueryPermissionInputType {
    RoleID: string;
}
export declare class CreateQuerySystemUserInput {
    Name: string;
    CategoryID?: string;
    CategoryPath?: string;
    UserQuestion?: string;
    Description?: string;
    SQL?: string;
    TechnicalDescription?: string;
    OriginalSQL?: string;
    Feedback?: string;
    Status?: QueryStatus;
    QualityRank?: number;
    ExecutionCostRank?: number;
    UsesTemplate?: boolean;
    AuditQueryRuns?: boolean;
    CacheEnabled?: boolean;
    CacheTTLMinutes?: number;
    CacheMaxSize?: number;
    Permissions?: QueryPermissionInputType[];
}
export declare class UpdateQuerySystemUserInput {
    ID: string;
    Name?: string;
    CategoryID?: string;
    CategoryPath?: string;
    UserQuestion?: string;
    Description?: string;
    SQL?: string;
    TechnicalDescription?: string;
    OriginalSQL?: string;
    Feedback?: string;
    Status?: QueryStatus;
    QualityRank?: number;
    ExecutionCostRank?: number;
    UsesTemplate?: boolean;
    AuditQueryRuns?: boolean;
    CacheEnabled?: boolean;
    CacheTTLMinutes?: number;
    CacheMaxSize?: number;
    Permissions?: QueryPermissionInputType[];
}
export declare class QueryFieldType {
    ID: string;
    QueryID: string;
    Name: string;
    Description?: string;
    Sequence: number;
    SQLBaseType?: string;
    SQLFullType?: string;
    SourceEntityID?: string;
    SourceEntity?: string;
    SourceFieldName?: string;
    IsComputed: boolean;
    ComputationDescription?: string;
    IsSummary?: boolean;
    SummaryDescription?: string;
}
export declare class QueryParameterType {
    ID: string;
    QueryID: string;
    Name: string;
    Description?: string;
    Type: string;
    IsRequired: boolean;
    DefaultValue?: string;
    SampleValue?: string;
    ValidationFilters?: string;
}
export declare class QueryEntityType {
    ID: string;
    QueryID: string;
    EntityID: string;
    Entity?: string;
}
export declare class QueryPermissionType {
    ID: string;
    QueryID: string;
    RoleID: string;
    Role?: string;
}
export declare class CreateQueryResultType {
    Success: boolean;
    ErrorMessage?: string;
    ID?: string;
    Name?: string;
    Description?: string;
    CategoryID?: string;
    Category?: string;
    SQL?: string;
    Status?: string;
    QualityRank?: number;
    EmbeddingVector?: string;
    EmbeddingModelID?: string;
    EmbeddingModelName?: string;
    Fields?: QueryFieldType[];
    Parameters?: QueryParameterType[];
    Entities?: QueryEntityType[];
    Permissions?: QueryPermissionType[];
}
export declare class UpdateQueryResultType {
    Success: boolean;
    ErrorMessage?: string;
    ID?: string;
    Name?: string;
    Description?: string;
    CategoryID?: string;
    Category?: string;
    SQL?: string;
    Status?: string;
    QualityRank?: number;
    EmbeddingVector?: string;
    EmbeddingModelID?: string;
    EmbeddingModelName?: string;
    Fields?: QueryFieldType[];
    Parameters?: QueryParameterType[];
    Entities?: QueryEntityType[];
    Permissions?: QueryPermissionType[];
}
export declare class DeleteQueryResultType {
    Success: boolean;
    ErrorMessage?: string;
    ID?: string;
    Name?: string;
    Description?: string;
    CategoryID?: string;
    SQL?: string;
    Status?: string;
}
export declare class MJQueryResolverExtended extends MJQueryResolver {
    /**
     * Creates a new query with the provided attributes. This mutation is restricted to system users only.
     * @param input - CreateQuerySystemUserInput containing all the query attributes
     * @param context - Application context containing user information
     * @returns CreateQueryResultType with success status and query data
     */
    CreateQuerySystemUser(input: CreateQuerySystemUserInput, context: AppContext, pubSub: PubSubEngine): Promise<CreateQueryResultType>;
    protected createPermissions(p: DatabaseProviderBase, permissions: QueryPermissionInputType[], queryID: string, contextUser: UserInfo): Promise<QueryPermissionType[]>;
    /**
     * Updates an existing query with the provided attributes. This mutation is restricted to system users only.
     * @param input - UpdateQuerySystemUserInput containing the query ID and fields to update
     * @param context - Application context containing user information
     * @returns UpdateQueryResultType with success status and updated query data including related entities
     */
    UpdateQuerySystemUser(input: UpdateQuerySystemUserInput, context: AppContext, pubSub: PubSubEngine): Promise<UpdateQueryResultType>;
    /**
     * Deletes a query by ID. This mutation is restricted to system users only.
     * @param ID - The ID of the query to delete
     * @param options - Delete options controlling action execution
     * @param context - Application context containing user information
     * @returns DeleteQueryResultType with success status and deleted query data
     */
    DeleteQuerySystemResolver(ID: string, options: DeleteOptionsInput | null, context: AppContext, pubSub: PubSubEngine): Promise<DeleteQueryResultType>;
    /**
     * Finds or creates a category hierarchy based on the provided path.
     * Path format: "Parent/Child/Grandchild" - case insensitive lookup and creation.
     * @param categoryPath - Slash-separated category path
     * @param md - Metadata instance
     * @param contextUser - User context for operations
     * @returns The ID of the final category in the path
     */
    private findOrCreateCategoryPath;
    /**
     * Finds an existing query by name and category ID using RunView.
     * Bypasses metadata cache to ensure we get the latest data from database.
     * @param provider - Database provider
     * @param queryName - Name of the query to find
     * @param categoryID - Category ID (can be null)
     * @param contextUser - User context for database operations
     * @returns The matching query info or null if not found
     */
    private findExistingQuery;
    /**
     * Finds a category by name and parent ID using RunView.
     * Bypasses metadata cache to ensure we get the latest data from database.
     * @param categoryName - Name of the category to find
     * @param parentID - Parent category ID (null for root level)
     * @param contextUser - User context for database operations
     * @returns The matching category entity or null if not found
     */
    private findCategoryByNameAndParent;
}
//# sourceMappingURL=CreateQueryResolver.d.ts.map