using System.ComponentModel.DataAnnotations;

namespace DramaLing.Api.Models.Entities;

public class SentenceAnalysisCache
{
    [Key]
    public Guid Id { get; set; }

    [Required]
    [StringLength(64)]
    public string InputTextHash { get; set; } = string.Empty;

    [Required]
    [StringLength(1000)]
    public string InputText { get; set; } = string.Empty;

    [StringLength(1000)]
    public string? CorrectedText { get; set; }

    public bool HasGrammarErrors { get; set; } = false;

    public string? GrammarCorrections { get; set; } // JSON 格式

    [Required]
    public string AnalysisResult { get; set; } = string.Empty; // JSON 格式

    public string? HighValueWords { get; set; } // JSON 格式，高價值詞彙列表

    public string? PhrasesDetected { get; set; } // JSON 格式，檢測到的片語

    [Required]
    public DateTime CreatedAt { get; set; }

    [Required]
    public DateTime ExpiresAt { get; set; }

    public int AccessCount { get; set; } = 0;

    public DateTime? LastAccessedAt { get; set; }
}