package top.tqx.demo_1.service;

import top.tqx.demo_1.dto.RagRequest;
import top.tqx.demo_1.entity.ChatMessage;
import top.tqx.demo_1.entity.ChatReference;
import top.tqx.demo_1.entity.ChatSession;

import java.util.List;

public interface ChatService {

    ChatSession createSession(Long userId, String sessionId);

    ChatSession getOrCreateSession(Long userId, String sessionId);

    ChatSession updateSessionSummary(Long sessionId, String summary);

    ChatMessage saveUserMessage(Long sessionId, String content, String kbPaths);

    ChatMessage saveAssistantMessage(Long sessionId, String content, String answer, String kbPaths, String messageType, Integer isFinished, Long durationMs, String images, String sources);

    ChatReference saveReference(Long messageId, String chunkId, String docPath, String docName, Integer page, String excerpt, Double score);

    List<ChatReference> saveReferences(Long messageId, List<ChatReference> references);

    List<ChatSession> getUserSessions(Long userId);

    List<ChatMessage> getSessionMessages(String sessionId);

    List<RagRequest.HistoryItem> getSessionMessagesAsHistory(String sessionId);

    List<ChatReference> getMessageReferences(Long messageId);

    List<ChatReference> getSessionReferences(String sessionId);

    boolean deleteSession(String sessionId, Long userId);

    boolean deleteSessions(List<String> sessionIds, Long userId);
}