import { PubSubEngine } from 'type-graphql';
import { Metadata, UserInfo, EntityFieldInfo, EntityInfo, EntityRelationshipInfo } from '@memberjunction/core';
import { AppContext, UserPayload } from '../types.js';
import { DataContext } from '@memberjunction/data-context';
import { SkipAPIRequest, SkipAPIResponse, SkipMessage, SkipAPIAnalysisCompleteResponse, SkipAPIDataRequestResponse, SkipAPIClarifyingQuestionResponse, SkipEntityInfo, SkipQueryInfo, SkipAPIRequestAPIKey, SkipRequestPhase, SkipAPIAgentNote, SkipAPIAgentNoteType, SkipEntityFieldInfo, SkipEntityRelationshipInfo, SkipEntityFieldValueInfo, SkipAPILearningCycleRequest, SkipConversation, SkipAPIArtifact, SkipAPIAgentRequest } from '@memberjunction/skip-types';
import { ConversationDetailEntity, ConversationEntity, DataContextEntity } from '@memberjunction/core-entities';
import mssql from 'mssql';
import { CompositeKeyInputType } from '../generic/KeyInputOutputTypes.js';
import { GetDataAccessToken } from './GetDataResolver.js';
declare class ReattachConversationResponse {
    lastStatusMessage?: string;
    startTime?: Date;
}
declare enum SkipResponsePhase {
    ClarifyingQuestion = "clarifying_question",
    DataRequest = "data_request",
    AnalysisComplete = "analysis_complete"
}
export declare class AskSkipResultType {
    Success: boolean;
    Status: string;
    ResponsePhase: SkipResponsePhase;
    Result: string;
    ConversationId: string;
    UserMessageConversationDetailId: string;
    AIMessageConversationDetailId: string;
}
export declare class ManualLearningCycleResultType {
    Success: boolean;
    Message: string;
}
export declare class CycleDetailsType {
    LearningCycleId: string;
    StartTime: string;
    RunningForMinutes: number;
}
export declare class RunningOrganizationType {
    OrganizationId: string;
    LearningCycleId: string;
    StartTime: string;
    RunningForMinutes: number;
}
export declare class LearningCycleStatusType {
    IsSchedulerRunning: boolean;
    LastRunTime: string;
    RunningOrganizations: RunningOrganizationType[];
}
export declare class StopLearningCycleResultType {
    Success: boolean;
    Message: string;
    WasRunning: boolean;
    CycleDetails: CycleDetailsType;
}
type BaseSkipRequest = {
    entities: SkipEntityInfo[];
    queries: SkipQueryInfo[];
    notes: SkipAPIAgentNote[];
    noteTypes: SkipAPIAgentNoteType[];
    requests: SkipAPIAgentRequest[];
    accessToken: GetDataAccessToken;
    organizationID: string;
    organizationInfo: any;
    apiKeys: SkipAPIRequestAPIKey[];
    callingServerURL: string;
    callingServerAPIKey: string;
    callingServerAccessToken: string;
    userEmail: string;
};
export declare class AskSkipResolver {
    private static _defaultNewChatName;
    private static _maxHistoricalMessages;
    ExecuteAskSkipRecordChat(UserQuestion: string, ConversationId: string, EntityName: string, compositeKey: CompositeKeyInputType, { dataSource, userPayload, providers }: AppContext, pubSub: PubSubEngine): Promise<AskSkipResultType>;
    protected handleSimpleSkipChatPostRequest(input: SkipAPIRequest, convoEntity?: ConversationEntity, convoDetailEntity?: ConversationDetailEntity, createAIMessageConversationDetail?: boolean, user?: UserInfo, userPayload?: UserPayload): Promise<AskSkipResultType>;
    protected CreateAIMessageConversationDetail(apiResponse: SkipAPIResponse, conversationID: string, user: UserInfo, userPayload: UserPayload): Promise<string>;
    protected buildBaseSkipRequest(contextUser: UserInfo, dataSource: mssql.ConnectionPool, includeEntities: boolean, includeQueries: boolean, includeNotes: boolean, filterUserNotesToContextUser: boolean, includeRequests: boolean, forceEntitiesRefresh?: boolean, includeCallBackKeyAndAccessToken?: boolean, additionalTokenInfo?: any): Promise<BaseSkipRequest>;
    protected buildSkipLearningAPIRequest(learningCycleId: string, lastLearningCycleDate: Date, includeEntities: boolean, includeQueries: boolean, includeNotes: boolean, includeRequests: boolean, dataSource: mssql.ConnectionPool, contextUser: UserInfo, forceEntitiesRefresh?: boolean, includeCallBackKeyAndAccessToken?: boolean): Promise<SkipAPILearningCycleRequest>;
    protected BuildSkipLearningCycleNewConversations(lastLearningCycleDate: Date, dataSource: mssql.ConnectionPool, contextUser: UserInfo): Promise<SkipConversation[]>;
    protected BuildSkipRequests(contextUser: UserInfo): Promise<SkipAPIAgentRequest[]>;
    protected GetLastCompleteLearningCycleDate(agentID: string, user: UserInfo): Promise<Date>;
    protected buildSkipChatAPIRequest(messages: SkipMessage[], conversationId: string, dataContext: DataContext, requestPhase: SkipRequestPhase, includeEntities: boolean, includeQueries: boolean, includeNotes: boolean, includeRequests: boolean, contextUser: UserInfo, dataSource: mssql.ConnectionPool, forceEntitiesRefresh?: boolean, includeCallBackKeyAndAccessToken?: boolean): Promise<SkipAPIRequest>;
    protected buildSkipAPIArtifacts(contextUser: UserInfo, dataSource: mssql.ConnectionPool, conversationId: string): Promise<SkipAPIArtifact[]>;
    ExecuteAskSkipRunScript({ dataSource, userPayload }: AppContext, pubSub: PubSubEngine, DataContextId: string, ScriptText: string): Promise<AskSkipResultType>;
    protected buildSkipAPIKeys(): SkipAPIRequestAPIKey[];
    ReattachToProcessingConversation(ConversationId: string, { userPayload, providers }: AppContext, pubSub: PubSubEngine): Promise<ReattachConversationResponse | null>;
    ExecuteAskSkipAnalysisQuery(UserQuestion: string, ConversationId: string, { dataSource, userPayload, providers }: AppContext, pubSub: PubSubEngine, DataContextId?: string, ForceEntityRefresh?: boolean, StartTime?: Date): Promise<AskSkipResultType>;
    protected buildQueryCategoryPath(md: Metadata, categoryID: string): string;
    protected BuildSkipQueries(status?: "Pending" | "In-Review" | "Approved" | "Rejected" | "Obsolete"): SkipQueryInfo[];
    protected PackEntityRows(e: EntityInfo, dataSource: mssql.ConnectionPool): Promise<any[]>;
    protected PackFieldPossibleValues(f: EntityFieldInfo, dataSource: mssql.ConnectionPool): Promise<SkipEntityFieldValueInfo[]>;
    protected GetFieldDistinctValues(f: EntityFieldInfo, dataSource: mssql.ConnectionPool): Promise<SkipEntityFieldValueInfo[]>;
    private static __skipEntitiesCache$;
    private static __lastRefreshTime;
    private static __refreshInProgress;
    private refreshSkipEntities;
    BuildSkipEntities(dataSource: mssql.ConnectionPool, forceRefresh?: boolean, refreshIntervalMinutes?: number): Promise<SkipEntityInfo[]>;
    protected PackSingleSkipEntityInfo(e: EntityInfo, dataSource: mssql.ConnectionPool): Promise<SkipEntityInfo>;
    protected PackSingleSkipEntityRelationship(r: EntityRelationshipInfo): SkipEntityRelationshipInfo;
    protected PackSingleSkipEntityField(f: EntityFieldInfo, dataSource: mssql.ConnectionPool): Promise<SkipEntityFieldInfo>;
    protected HandleSkipChatInitialObjectLoading(dataSource: mssql.ConnectionPool, ConversationId: string, UserQuestion: string, user: UserInfo, userPayload: UserPayload, md: Metadata, DataContextId: string): Promise<{
        convoEntity: ConversationEntity;
        dataContextEntity: DataContextEntity;
        convoDetailEntity: ConversationDetailEntity;
        dataContext: DataContext;
    }>;
    protected LoadConversationDetailsIntoSkipMessages(dataSource: mssql.ConnectionPool, ConversationId: string, maxHistoricalMessages?: number, roleFilter?: string): Promise<SkipMessage[]>;
    protected MapDBRoleToSkipRole(role: string): 'user' | 'system';
    protected HandleSkipChatRequest(input: SkipAPIRequest, UserQuestion: string, user: UserInfo, dataSource: mssql.ConnectionPool, ConversationId: string, userPayload: UserPayload, pubSub: PubSubEngine, md: Metadata, convoEntity: ConversationEntity, convoDetailEntity: ConversationDetailEntity, dataContext: DataContext, dataContextEntity: DataContextEntity, conversationDetailCount: number, startTime: Date): Promise<AskSkipResultType>;
    protected buildSkipPostHeaders(): {
        [key: string]: string;
    };
    protected PublishApiResponseUserUpdateMessage(apiResponse: SkipAPIResponse, userPayload: UserPayload, conversationID: string, pubSub: PubSubEngine): Promise<void>;
    protected HandleAnalysisComplete(apiRequest: SkipAPIRequest, apiResponse: SkipAPIAnalysisCompleteResponse, UserQuestion: string, user: UserInfo, dataSource: mssql.ConnectionPool, ConversationId: string, userPayload: UserPayload, pubSub: PubSubEngine, convoEntity: ConversationEntity, convoDetailEntity: ConversationDetailEntity, dataContext: DataContext, dataContextEntity: DataContextEntity, startTime: Date): Promise<AskSkipResultType>;
    protected HandleClarifyingQuestionPhase(apiRequest: SkipAPIRequest, apiResponse: SkipAPIClarifyingQuestionResponse, UserQuestion: string, user: UserInfo, dataSource: mssql.ConnectionPool, ConversationId: string, userPayload: UserPayload, pubSub: PubSubEngine, convoEntity: ConversationEntity, convoDetailEntity: ConversationDetailEntity, startTime: Date): Promise<AskSkipResultType>;
    protected HandleDataRequestPhase(apiRequest: SkipAPIRequest, apiResponse: SkipAPIDataRequestResponse, UserQuestion: string, user: UserInfo, dataSource: mssql.ConnectionPool, ConversationId: string, userPayload: UserPayload, pubSub: PubSubEngine, convoEntity: ConversationEntity, convoDetailEntity: ConversationDetailEntity, dataContext: DataContext, dataContextEntity: DataContextEntity, conversationDetailCount: number, startTime: Date): Promise<AskSkipResultType>;
    protected FinishConversationAndNotifyUser(apiResponse: SkipAPIAnalysisCompleteResponse, dataContext: DataContext, dataContextEntity: DataContextEntity, md: Metadata, user: UserInfo, convoEntity: ConversationEntity, pubSub: PubSubEngine, userPayload: UserPayload, dataSource: mssql.ConnectionPool, startTime: Date): Promise<{
        AIMessageConversationDetailID: string;
    }>;
    private setConversationStatus;
    protected getAgentNoteTypeIDByName(name: string, defaultNoteType?: string): string;
    protected getViewData(ViewId: string, user: UserInfo): Promise<any>;
}
export default AskSkipResolver;
//# sourceMappingURL=AskSkipResolver.d.ts.map