using Fantasy;
using Fantasy.Entitas.Interface;

namespace NB.Game;

public class AwardItemDestroySystem : DestroySystem<AwardItem>
{
    protected override void Destroy(AwardItem self)
    {
        self.ConfigId = 0;
        self.Count = 0;
    }
}

public static class AwardItemSystem
{
    public static AwardInfo ToAwardInfo(this AwardItem item)
    {
        return new AwardInfo()
        {
            ConfigId = item.ConfigId,
            Count = item.Count
        };
    }

    public static List<AwardInfo> ToAwardInfo(this List<AwardItem> items)
    {
        var list = new List<AwardInfo>();
        foreach (var item in items)
        {
            list.Add(item.ToAwardInfo());
        }

        return list;
    }
}