namespace ChatRAG.Models
{
///
/// Modelo para entrada de dados (CREATE/UPDATE)
///
public class DocumentInput
{
public string? Id { get; set; }
public string Title { get; set; } = string.Empty;
public string Content { get; set; } = string.Empty;
public string ProjectId { get; set; } = string.Empty;
public Dictionary? Metadata { get; set; }
public DateTime? CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
public static DocumentInput FromTextoComEmbedding(TextoComEmbedding texto)
{
return new DocumentInput
{
Id = texto.Id,
Title = texto.Titulo,
Content = texto.Conteudo,
ProjectId = texto.ProjetoId,
CreatedAt = DateTime.UtcNow,
UpdatedAt = DateTime.UtcNow
};
}
public DocumentInput WithMetadata(string key, object value)
{
Metadata ??= new Dictionary();
Metadata[key] = value;
return this;
}
public bool IsValid()
{
return !string.IsNullOrWhiteSpace(Title) &&
!string.IsNullOrWhiteSpace(Content) &&
!string.IsNullOrWhiteSpace(ProjectId);
}
}
}