{"version":3,"sources":["../src/types/chatbot.ts"],"sourcesContent":["/**\n * Chatbot types for AI-assisted student conversations\n */\n\n/**\n * Message author — mirrors the backend `chatbot_messages.role` column.\n * Use the constants instead of raw strings when comparing roles.\n */\nexport const CHATBOT_MESSAGE_ROLES = {\n  USER: 'user',\n  ASSISTANT: 'assistant',\n} as const;\n\nexport type ChatbotRole =\n  (typeof CHATBOT_MESSAGE_ROLES)[keyof typeof CHATBOT_MESSAGE_ROLES];\n\n/**\n * Single message inside a conversation\n */\nexport interface ChatbotMessage {\n  id: string;\n  conversationId: string;\n  role: ChatbotRole;\n  content: string;\n  createdAt: Date | string;\n}\n\n/**\n * Conversation metadata displayed in the history list\n */\nexport interface ChatbotConversation {\n  id: string;\n  title: string | null;\n  lastMessageAt: Date | string;\n  createdAt: Date | string;\n}\n\n/**\n * Page-level hints the frontend passes along so the backend can enrich\n * the prompt. All fields optional. `questionId` is meaningful only when\n * accompanied by `activityId`.\n */\nexport interface ChatbotCurrentContext {\n  activityId?: string;\n  questionId?: string;\n  lessonId?: string;\n}\n\n/**\n * Payload sent when publishing a new student message\n */\nexport interface SendChatbotMessagePayload {\n  message: string;\n  conversationId?: string;\n  currentContext?: ChatbotCurrentContext;\n}\n\n/**\n * Data returned by the send-message endpoint\n */\nexport interface SendChatbotMessageResult {\n  conversationId: string;\n  userMessage: ChatbotMessage;\n  assistantMessage: ChatbotMessage;\n}\n\n/**\n * Minimal user shape required to render the UI (label and optional photo)\n */\nexport interface ChatbotUser {\n  id: string;\n  name: string;\n  photo?: string | null;\n}\n\n/**\n * Transport-agnostic API client. Implemented by the frontend-aluno-web\n * adapter using axios; can be swapped for fetch/mock in tests and stories.\n */\nexport interface ChatbotApiClient {\n  /**\n   * Send a message and receive the assistant reply.\n   */\n  sendMessage(\n    payload: SendChatbotMessagePayload\n  ): Promise<SendChatbotMessageResult>;\n  /**\n   * List the current user's conversations.\n   */\n  listConversations(params: {\n    page: number;\n    limit: number;\n  }): Promise<{ conversations: ChatbotConversation[]; total: number }>;\n  /**\n   * Fetch messages of a specific conversation.\n   */\n  getMessages(\n    conversationId: string,\n    params: { page: number; limit: number }\n  ): Promise<{ messages: ChatbotMessage[]; total: number }>;\n  /**\n   * Delete a conversation.\n   */\n  deleteConversation(conversationId: string): Promise<void>;\n}\n\n/**\n * Alias consumed by the apps under the name `ChatbotMessageData`.\n * Re-exported here so it is reachable via the `types/chatbot` subpath\n * (and not only via the root barrel).\n */\nexport type { ChatbotMessage as ChatbotMessageData };\n"],"mappings":";AAQO,IAAM,wBAAwB;AAAA,EACnC,MAAM;AAAA,EACN,WAAW;AACb;","names":[]}