using NexusReader.Application.DTOs.AI;

namespace NexusReader.UI.Shared.Models;

/// <summary>
/// Defines the active tab state for the unified mobile reader toolbar.
/// </summary>
public enum MobileReaderTab
{
    Reader,
    Graph,
    Concepts
}

/// <summary>
/// Screen coordinates for text selection popup positioning.
/// </summary>
public record SelectionCoordinates(double Top, double Left, double Width, double Height, double Bottom, double ViewportWidth);

/// <summary>
/// Represents a message in the KM-RAG global and mobile intelligence chat threads.
/// </summary>
public class ChatMessage
{
    public string Id { get; set; } = Guid.NewGuid().ToString();
    public string Sender { get; set; } = string.Empty; // "User" or "AI"
    public string Text { get; set; } = string.Empty;
    public DateTime Timestamp { get; set; } = DateTime.UtcNow;
    public List<ResponseSegment> Segments { get; set; } = new();
    public List<CitationDto> Citations { get; set; } = new();

    public string ClearText { get; set; } = string.Empty;
    public string BlurredTeaserText { get; set; } = string.Empty;
    public bool IsPaywalled { get; set; }
    public string SourceBookTitle { get; set; } = string.Empty;
    public string DocumentId { get; set; } = string.Empty;
}

/// <summary>
/// Represents a parsed segment of an intelligence response, potentially referencing a citation.
/// </summary>
public class ResponseSegment
{
    public string Text { get; set; } = string.Empty;
    public bool IsCitation { get; set; }
    public string CitationId { get; set; } = string.Empty;
}
