import { GraphQLClient } from 'graphql-request';
import { UseMutationOptions, UseQueryOptions } from '@tanstack/react-query';
export type Maybe<T> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends {
    [key: string]: unknown;
}> = {
    [K in keyof T]: T[K];
};
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
    [SubKey in K]?: Maybe<T[SubKey]>;
};
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
    [SubKey in K]: Maybe<T[SubKey]>;
};
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
    ID: string;
    String: string;
    Boolean: boolean;
    Int: number;
    Float: number;
    JSON: any;
};
export type AgentMetadata = {
    __typename?: 'AgentMetadata';
    avatarUrl?: Maybe<Scalars['String']>;
    displayName: Scalars['String'];
    key: Scalars['String'];
};
export type AuthResponse = {
    __typename?: 'AuthResponse';
    accessToken: AuthTokenData;
    anonymous: Scalars['Boolean'];
    anonymousId?: Maybe<Scalars['String']>;
    email?: Maybe<Scalars['String']>;
    externalId?: Maybe<Scalars['String']>;
    name?: Maybe<Scalars['String']>;
    refreshToken: AuthTokenData;
    userId: Scalars['String'];
};
export type AuthTokenData = {
    __typename?: 'AuthTokenData';
    expAt: Scalars['Int'];
    token: Scalars['String'];
};
export type Conversation = {
    __typename?: 'Conversation';
    createdAt?: Maybe<Scalars['String']>;
    id?: Maybe<Scalars['String']>;
    title?: Maybe<Scalars['String']>;
    updatedAt?: Maybe<Scalars['String']>;
};
export type ConversationEvent = {
    __typename?: 'ConversationEvent';
    kind: Scalars['String'];
    payload: Scalars['JSON'];
};
export type ConversationListItem = {
    __typename?: 'ConversationListItem';
    agent: AgentMetadata;
    id: Scalars['String'];
    lastMessage?: Maybe<Message>;
    title: Scalars['String'];
};
export type Message = {
    __typename?: 'Message';
    content?: Maybe<Scalars['String']>;
    conversationId: Scalars['String'];
    createdAt?: Maybe<Scalars['String']>;
    id: Scalars['String'];
    pending: Scalars['Boolean'];
    role: Scalars['String'];
    turn: Scalars['Int'];
    updatedAt?: Maybe<Scalars['String']>;
    userId?: Maybe<Scalars['String']>;
};
export type MessageInput = {
    content: Scalars['String'];
};
export type Mutation = {
    __typename?: 'Mutation';
    login: AuthResponse;
    refreshAuth: AuthResponse;
    sendMessage: SendMessageResponse;
    updateConversationContext?: Maybe<Conversation>;
};
export type MutationLoginArgs = {
    anonymousId?: InputMaybe<Scalars['String']>;
    email?: InputMaybe<Scalars['String']>;
    externalId?: InputMaybe<Scalars['String']>;
    hash?: InputMaybe<Scalars['String']>;
    name?: InputMaybe<Scalars['String']>;
};
export type MutationRefreshAuthArgs = {
    refreshToken: Scalars['String'];
};
export type MutationSendMessageArgs = {
    agent?: InputMaybe<Scalars['String']>;
    context?: InputMaybe<Scalars['JSON']>;
    conversationId?: InputMaybe<Scalars['String']>;
    message: MessageInput;
};
export type MutationUpdateConversationContextArgs = {
    context: Scalars['JSON'];
    conversationId: Scalars['String'];
};
export type Query = {
    __typename?: 'Query';
    getConversations?: Maybe<Array<ConversationListItem>>;
};
export type SendMessageResponse = {
    __typename?: 'SendMessageResponse';
    conversationId: Scalars['String'];
    messageId: Scalars['String'];
};
export type Subscription = {
    __typename?: 'Subscription';
    subscribeConversationEvents: ConversationEvent;
};
export type SubscriptionSubscribeConversationEventsArgs = {
    agent?: InputMaybe<Scalars['String']>;
    context?: InputMaybe<Scalars['JSON']>;
    conversationId?: InputMaybe<Scalars['String']>;
};
export type LoginMutationVariables = Exact<{
    email: Scalars['String'];
    name: Scalars['String'];
    hash: Scalars['String'];
    anonymousId: Scalars['String'];
    externalId: Scalars['String'];
}>;
export type LoginMutation = {
    __typename?: 'Mutation';
    login: {
        __typename?: 'AuthResponse';
        anonymousId?: string | null;
        anonymous: boolean;
        email?: string | null;
        name?: string | null;
        userId: string;
        accessToken: {
            __typename?: 'AuthTokenData';
            token: string;
            expAt: number;
        };
        refreshToken: {
            __typename?: 'AuthTokenData';
            token: string;
            expAt: number;
        };
    };
};
export type RefreshAuthMutationVariables = Exact<{
    refreshToken: Scalars['String'];
}>;
export type RefreshAuthMutation = {
    __typename?: 'Mutation';
    refreshAuth: {
        __typename?: 'AuthResponse';
        anonymousId?: string | null;
        anonymous: boolean;
        email?: string | null;
        name?: string | null;
        userId: string;
        accessToken: {
            __typename?: 'AuthTokenData';
            token: string;
            expAt: number;
        };
        refreshToken: {
            __typename?: 'AuthTokenData';
            token: string;
            expAt: number;
        };
    };
};
export type SendMessageMutationVariables = Exact<{
    message: MessageInput;
    conversationId?: InputMaybe<Scalars['String']>;
    agent?: InputMaybe<Scalars['String']>;
    context?: InputMaybe<Scalars['JSON']>;
}>;
export type SendMessageMutation = {
    __typename?: 'Mutation';
    sendMessage: {
        __typename?: 'SendMessageResponse';
        conversationId: string;
    };
};
export type UpdateConversationContextMutationVariables = Exact<{
    conversationId: Scalars['String'];
    context: Scalars['JSON'];
}>;
export type UpdateConversationContextMutation = {
    __typename?: 'Mutation';
    updateConversationContext?: {
        __typename?: 'Conversation';
        id?: string | null;
    } | null;
};
export type GetConversationsQueryVariables = Exact<{
    [key: string]: never;
}>;
export type GetConversationsQuery = {
    __typename?: 'Query';
    getConversations?: Array<{
        __typename?: 'ConversationListItem';
        id: string;
        title: string;
        lastMessage?: {
            __typename?: 'Message';
            id: string;
            content?: string | null;
            userId?: string | null;
            createdAt?: string | null;
        } | null;
        agent: {
            __typename?: 'AgentMetadata';
            key: string;
            displayName: string;
            avatarUrl?: string | null;
        };
    }> | null;
};
export type SubscribeConversationEventsSubscriptionVariables = Exact<{
    conversationId?: InputMaybe<Scalars['String']>;
    agent?: InputMaybe<Scalars['String']>;
    context?: InputMaybe<Scalars['JSON']>;
}>;
export type SubscribeConversationEventsSubscription = {
    __typename?: 'Subscription';
    subscribeConversationEvents: {
        __typename?: 'ConversationEvent';
        kind: string;
        payload: any;
    };
};
export declare const LoginDocument = "\n    mutation Login($email: String!, $name: String!, $hash: String!, $anonymousId: String!, $externalId: String!) {\n  login(\n    email: $email\n    name: $name\n    hash: $hash\n    anonymousId: $anonymousId\n    externalId: $externalId\n  ) {\n    accessToken {\n      token\n      expAt\n    }\n    anonymousId\n    refreshToken {\n      token\n      expAt\n    }\n    anonymous\n    email\n    name\n    userId\n  }\n}\n    ";
export declare const useLoginMutation: <TError = unknown, TContext = unknown>(client: GraphQLClient, options?: UseMutationOptions<LoginMutation, TError, Exact<{
    email: Scalars['String'];
    name: Scalars['String'];
    hash: Scalars['String'];
    anonymousId: Scalars['String'];
    externalId: Scalars['String'];
}>, TContext> | undefined, headers?: any) => import("@tanstack/react-query").UseMutationResult<LoginMutation, TError, Exact<{
    email: Scalars['String'];
    name: Scalars['String'];
    hash: Scalars['String'];
    anonymousId: Scalars['String'];
    externalId: Scalars['String'];
}>, TContext>;
export declare const RefreshAuthDocument = "\n    mutation RefreshAuth($refreshToken: String!) {\n  refreshAuth(refreshToken: $refreshToken) {\n    accessToken {\n      token\n      expAt\n    }\n    anonymousId\n    refreshToken {\n      token\n      expAt\n    }\n    anonymous\n    email\n    name\n    userId\n  }\n}\n    ";
export declare const useRefreshAuthMutation: <TError = unknown, TContext = unknown>(client: GraphQLClient, options?: UseMutationOptions<RefreshAuthMutation, TError, Exact<{
    refreshToken: Scalars['String'];
}>, TContext> | undefined, headers?: any) => import("@tanstack/react-query").UseMutationResult<RefreshAuthMutation, TError, Exact<{
    refreshToken: Scalars['String'];
}>, TContext>;
export declare const SendMessageDocument = "\n    mutation sendMessage($message: MessageInput!, $conversationId: String, $agent: String, $context: JSON) {\n  sendMessage(\n    message: $message\n    conversationId: $conversationId\n    agent: $agent\n    context: $context\n  ) {\n    conversationId\n  }\n}\n    ";
export declare const useSendMessageMutation: <TError = unknown, TContext = unknown>(client: GraphQLClient, options?: UseMutationOptions<SendMessageMutation, TError, Exact<{
    message: MessageInput;
    conversationId?: InputMaybe<string> | undefined;
    agent?: InputMaybe<string> | undefined;
    context?: InputMaybe<Scalars['JSON']>;
}>, TContext> | undefined, headers?: any) => import("@tanstack/react-query").UseMutationResult<SendMessageMutation, TError, Exact<{
    message: MessageInput;
    conversationId?: InputMaybe<string> | undefined;
    agent?: InputMaybe<string> | undefined;
    context?: InputMaybe<Scalars['JSON']>;
}>, TContext>;
export declare const UpdateConversationContextDocument = "\n    mutation updateConversationContext($conversationId: String!, $context: JSON!) {\n  updateConversationContext(conversationId: $conversationId, context: $context) {\n    id\n  }\n}\n    ";
export declare const useUpdateConversationContextMutation: <TError = unknown, TContext = unknown>(client: GraphQLClient, options?: UseMutationOptions<UpdateConversationContextMutation, TError, Exact<{
    conversationId: Scalars['String'];
    context: Scalars['JSON'];
}>, TContext> | undefined, headers?: any) => import("@tanstack/react-query").UseMutationResult<UpdateConversationContextMutation, TError, Exact<{
    conversationId: Scalars['String'];
    context: Scalars['JSON'];
}>, TContext>;
export declare const GetConversationsDocument = "\n    query GetConversations {\n  getConversations {\n    id\n    title\n    lastMessage {\n      id\n      content\n      userId\n      createdAt\n    }\n    agent {\n      key\n      displayName\n      avatarUrl\n    }\n  }\n}\n    ";
export declare const useGetConversationsQuery: <TData = GetConversationsQuery, TError = unknown>(client: GraphQLClient, variables?: GetConversationsQueryVariables, options?: UseQueryOptions<GetConversationsQuery, TError, TData, import("@tanstack/react-query").QueryKey> | undefined, headers?: any) => import("@tanstack/react-query").UseQueryResult<TData, TError>;
export declare const SubscribeConversationEventsDocument = "\n    subscription subscribeConversationEvents($conversationId: String, $agent: String, $context: JSON) {\n  subscribeConversationEvents(\n    conversationId: $conversationId\n    agent: $agent\n    context: $context\n  ) {\n    kind\n    payload\n  }\n}\n    ";
