package cz.jzitnik.game.entities.items;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

@Getter
@AllArgsConstructor
public class InventoryItem {
    private int amount;
    private final List<Item> item;

    public InventoryItem(int amount, Item item) {
        this.amount = amount;
        this.item = new ArrayList<>();
        for (int i = 0; i < amount; i++) {
            this.item.add(item);
        }
    }

    public InventoryItem() {
        this.item = new ArrayList<>();
        this.amount = 0;
    }

    public void decrease() {
        amount--;
        item.removeLast();
    }

    public void add(Item i) {
        amount++;
        item.add(i);
    }

    public InventoryItem(Item item) {
        this.amount = 1;
        this.item = new ArrayList<>();
        this.item.add(item);
    }
}
