using Fantasy.Entitas;
using MongoDB.Bson.Serialization.Attributes;

namespace NB.Chat;

public class MailConversation : Entity
{
    /// <summary>
    /// 第一id
    /// </summary>
    [BsonElement("id1")] public long FirstId;

    /// <summary>
    /// 第二id
    /// </summary>
    [BsonElement("id2")] public long SecondId;

    /// <summary>
    /// 会话
    /// </summary>
    [BsonElement("list")] public List<Mail> Mails = new List<Mail>();

    /// <summary>
    /// 第一个阅读时间
    /// </summary>
    [BsonElement("ft")] public long FirstReadTime;

    /// <summary>
    /// 第二阅读时间
    /// </summary>
    [BsonElement("st")] public long SecondReadTime;

    /// <summary>
    /// 最后更新时间
    /// </summary>
    [BsonElement("ut")] public long UpdateTime;

    /// <summary>
    /// 删除人标志
    /// </summary>
    [BsonElement("rid")] public HashSet<long> RemoveId = new HashSet<long>();

    /// <summary>
    /// 会话key，id-id，按大小排序
    /// </summary>
    [BsonIgnore] public string Key = string.Empty;

    /// <summary>
    /// 最后保存时间
    /// </summary>
    [BsonIgnore] public long NeedSaveTime = 0;

    /// <summary>
    /// 需要保存
    /// </summary>
    [BsonIgnore] public bool NeedSave;
}