package shop.alien.lawyer.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import shop.alien.entity.result.R;
import shop.alien.entity.store.LawyerAiInteractionLog;

import java.util.List;
import java.util.Map;

/**
 * AI交互日志 服务类
 *
 * @author system
 * @since 2025-01-XX
 */
public interface LawyerAiInteractionLogService extends IService<LawyerAiInteractionLog> {

    /**
     * 分页查询AI交互日志列表
     *
     * @param pageNum         页码
     * @param pageSize        页容
     * @param clientUserId    客户端用户ID
     * @param conversationId  会话ID
     * @param problemScenarioId 法律问题场景ID
     * @return IPage<LawyerAiInteractionLog>
     */
    R<IPage<LawyerAiInteractionLog>> getAiInteractionLogList(int pageNum, int pageSize, Integer clientUserId,
                                                        String conversationId, Integer problemScenarioId);

    /**
     * 根据会话ID查询交互日志列表
     *
     * @param conversationId 会话ID
     * @return List<LawyerAiInteractionLog>
     */
    List<LawyerAiInteractionLog> getListByConversationId(String conversationId);

    /**
     * 新增AI交互日志
     *
     * @param aiInteractionLog AI交互日志
     * @return R<LawyerAiInteractionLog>
     */
    R<LawyerAiInteractionLog> addAiInteractionLog(LawyerAiInteractionLog aiInteractionLog);

    /**
     * 编辑AI交互日志
     *
     * @param aiInteractionLog AI交互日志
     * @return R<LawyerAiInteractionLog>
     */
    R<LawyerAiInteractionLog> editAiInteractionLog(LawyerAiInteractionLog aiInteractionLog);

    /**
     * 删除AI交互日志
     *
     * @param id 主键
     * @return R<Boolean>
     */
    R<Boolean> deleteAiInteractionLog(Integer id);

    /**
     * AI聊天接口
     *
     * @param message     用户发送的消息内容
     * @param sessionId   会话ID（可选）
     * @param clientUserId 客户端用户ID（可选）
     * @return R<Map<String, Object>>
     */
    R<Map<String, Object>> sendAIMessage(String message, String sessionId, Integer clientUserId);

    /**
     * AI聊天接口
     *
     * @param queryText     用户发送的消息内容
     * @param responseText   AI回复内容
     * @param clientUserId 客户端用户ID
     * @return R<Map<String, Object>>
     */
    R<Map<String, Object>> saveChatLog(LawyerAiInteractionLog aiInteractionLog);

    R<Map<String, Object>> updatedLog(Integer id);

    R<IPage<LawyerAiInteractionLog>> getLogList(Integer clientUserId,Integer page, Integer size );
}

