package com.pharmacopoeia.repository;

import com.pharmacopoeia.entity.Conversation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;
import java.util.Optional;

public interface ConversationRepository extends JpaRepository<Conversation, Long> {
    Optional<Conversation> findByConversationId(String conversationId);
    List<Conversation> findByUserIdOrderByCreatedAtDesc(Long userId);

    /** 按用户分页查询对话列表 */
    Page<Conversation> findByUserKeyOrderByCreatedAtDesc(String userKey, Pageable pageable);
}