using System.Text.Json;
using Kafka.Lib.Auth.Model;

namespace Kafka.Lib.Warehouse;

public class ItemClaimChangeMessageType : IMessageType
{
    public string? ItemId { get; set; }
    public List<ClaimChagesModel>? Chages { get; set; }

    public string? Id { get; set; }

    public string? EventType { get; } = "ItemClaimChange";

    public string Text
    {
        get
        {
            return JsonSerializer.Serialize(this);
        }
        set
        {
            if (string.IsNullOrEmpty(value))
            {
                var obj = JsonSerializer.Deserialize<ItemClaimChangeMessageType>(value);

                if (obj != null)
                {
                    ItemId = obj.ItemId;
                    Chages = obj.Chages;
                }
            }
        }
    }
}