Tikfinity/Protocol/TikfinityEvent.cs
namespace TikfinitySbox;

/// <summary>
/// A normalized, bounded TikFinity event. Raw JSON is intentionally not retained.
/// </summary>
public sealed class TikfinityEvent
{
    public TikfinityEventKind Kind { get; set; }
    public string RawType { get; set; } = "";
    public string EventId { get; set; } = "";
    public long TimestampMilliseconds { get; set; }

    public string UserId { get; set; } = "";
    public string Username { get; set; } = "";
    public string Nickname { get; set; } = "";
    public string ProfilePictureUrl { get; set; } = "";

    public string GiftId { get; set; } = "";
    public string GiftName { get; set; } = "";
    public int GiftCoins { get; set; }
    public int TotalCoins { get; set; }
    public int RepeatCount { get; set; } = 1;
    public bool IsStreakable { get; set; }
    public bool HasRepeatEnd { get; set; }
    public bool RepeatEnd { get; set; }

    public string Comment { get; set; } = "";
    public int LikeCount { get; set; }
    public int ViewerCount { get; set; }

    public string Fingerprint()
    {
        if ( !string.IsNullOrWhiteSpace( EventId ) )
            return $"{RawType}|{EventId}|{RepeatCount}|{RepeatEnd}";

        return $"{RawType}|{UserId}|{Username}|{GiftId}|{GiftName}|{RepeatCount}|{RepeatEnd}|{LikeCount}|{TimestampMilliseconds}";
    }
}