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

namespace StellaOps.Feedser.Storage.Mongo.Advisories;

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

    [BsonElement("advisoryKey")]
    public string AdvisoryKey
    {
        get => Id;
        set => Id = value;
    }

    [BsonElement("payload")]
    public BsonDocument Payload { get; set; } = new();

    [BsonElement("modified")]
    public DateTime Modified { get; set; }

    [BsonElement("published")]
    public DateTime? Published { get; set; }

    [BsonElement("normalizedVersions")]
    [BsonIgnoreIfNull]
    public List<NormalizedVersionDocument>? NormalizedVersions { get; set; }
}
