using System;
using System.Collections.Generic;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;

namespace StellaOps.Feedser.Storage.Mongo.ChangeHistory;

[BsonIgnoreExtraElements]
public sealed class ChangeHistoryDocument
{
    [BsonId]
    public string Id { get; set; } = string.Empty;

    [BsonElement("source")]
    public string SourceName { get; set; } = string.Empty;

    [BsonElement("advisoryKey")]
    public string AdvisoryKey { get; set; } = string.Empty;

    [BsonElement("documentId")]
    public string DocumentId { get; set; } = string.Empty;

    [BsonElement("documentSha256")]
    public string DocumentSha256 { get; set; } = string.Empty;

    [BsonElement("currentHash")]
    public string CurrentHash { get; set; } = string.Empty;

    [BsonElement("previousHash")]
    public string? PreviousHash { get; set; }

    [BsonElement("currentSnapshot")]
    public string CurrentSnapshot { get; set; } = string.Empty;

    [BsonElement("previousSnapshot")]
    public string? PreviousSnapshot { get; set; }

    [BsonElement("changes")]
    public List<BsonDocument> Changes { get; set; } = new();

    [BsonElement("capturedAt")]
    public DateTime CapturedAt { get; set; }
}
