package port

import (
	"context"

	"github.com/orchard9/rdev/internal/domain"
)

// ConversationRepository defines operations for conversation persistence.
type ConversationRepository interface {
	// CreateConversation creates a new conversation.
	CreateConversation(ctx context.Context, projectID, title string) (*domain.Conversation, error)

	// GetConversation retrieves a conversation by ID.
	GetConversation(ctx context.Context, id domain.ConversationID) (*domain.Conversation, error)

	// ListConversations returns all conversations for a project.
	ListConversations(ctx context.Context, projectID string) ([]*domain.Conversation, error)

	// UpdateConversationTitle updates the conversation title.
	UpdateConversationTitle(ctx context.Context, id domain.ConversationID, title string) error

	// DeleteConversation deletes a conversation and all its messages.
	DeleteConversation(ctx context.Context, id domain.ConversationID) error

	// AddMessage adds a message to a conversation.
	AddMessage(ctx context.Context, conversationID domain.ConversationID, role domain.MessageRole, content string) (*domain.Message, error)

	// GetMessages retrieves all messages for a conversation.
	GetMessages(ctx context.Context, conversationID domain.ConversationID) ([]*domain.Message, error)

	// GetConversationWithMessages retrieves a conversation with all messages.
	GetConversationWithMessages(ctx context.Context, id domain.ConversationID) (*domain.ConversationWithMessages, error)
}
