using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;

namespace Insight.Infrastructure.Entities
{
    [BsonIgnoreExtraElements]
    public class HostUpdateEntity
    {
        [BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
        public string? Id { get; set; }

        [BsonElement("_host"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("host")]
        public string? Host { get; set; }

        [BsonElement("_batch"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("batch")]
        public string? Batch { get; set; }

        [BsonElement("insert")]
        public DateTime? Insert { get; set; }

        [BsonElement("update")]
        public DateTime? Update { get; set; }

        [BsonElement("name")]
        public string? Name { get; set; }

        [BsonElement("serial")]
        public string? Serial { get; set; } // os update id

        [BsonElement("description")]
        public string? Description { get; set; }

        [BsonElement("supporturl")]
        public string? SupportUrl { get; set; }

        [BsonElement("date")]
        public DateTime? Date { get; set; }

        [BsonElement("pending")]
        public bool? Pending { get; set; }

        [BsonElement("result"), BsonIgnoreIfNull] // installed only
        public string? Result { get; set; }

        [BsonElement("type"), BsonIgnoreIfNull] // pending only
        public string? Type { get; set; }

        [BsonElement("size"), BsonIgnoreIfNull] // pending only
        public decimal? Size { get; set; }

        [BsonElement("downloaded"), BsonIgnoreIfNull] // pending only
        public bool? IsDownloaded { get; set; }

        [BsonElement("inputrequest"), BsonIgnoreIfNull] // pending only
        public bool? CanRequestUserInput { get; set; }

        [BsonElement("reboot"), BsonIgnoreIfNull] // pending only
        public string? RebootBehavior { get; set; }
    }
}