using PetCompanion.Models.Enums; namespace PetCompanion.Models { public abstract class Item { public string Id { get; set; } public string Name { get; set; } public string Description { get; set; } public ItemType Type { get; set; } public ItemRarity Rarity { get; set; } public abstract void Use(ref Pet pet); } public abstract class EquipableItem : Item { public EquipmentSlot Slot { get; set; } public bool IsEquipped { get; set; } public virtual void Equip(ref Pet pet) { if (!IsEquipped) { pet.Equipment[Slot]?.Unequip(ref pet); pet.Equipment[Slot] = this; IsEquipped = true; } } public virtual void Unequip(ref Pet pet) { if (IsEquipped) { pet.Equipment[Slot] = null; IsEquipped = false; } } } public class ConsumableItem : Item { public Action Effect { get; set; } public override void Use(ref Pet pet) { Effect?.Invoke(pet); } } }