#include "Item.h"
#include <algorithm>
#include <iostream>

namespace ZL {

	void Inventory::addItem(const Item& item) {
		items.push_back(item);
		std::cout << "Item added to inventory: " << item.name << std::endl;
	}

	void Inventory::removeItem(const std::string& itemId) {
		auto it = std::find_if(items.begin(), items.end(),
			[&itemId](const Item& item) { return item.id == itemId; });
		if (it != items.end()) {
			std::cout << "Item removed from inventory: " << it->name << std::endl;
			items.erase(it);
		}
	}

	bool Inventory::hasItem(const std::string& itemId) const {
		return std::find_if(items.begin(), items.end(),
			[&itemId](const Item& item) { return item.id == itemId; }) != items.end();
	}

} // namespace ZL