#pragma once #include #include #include "CacheManager.h" class PokemonCard; class PokemonTCGAPIClient; class DownloadManager; /** @brief user pokedex class, handles caching and api access silently */ class Pokedex { private: std::vector cards; /** @brief download card collection using API client */ virtual void load_collection_remote(); /** @brief load cards from cache */ virtual void load_collection_local(); /** @brief verify all cards in collection */ virtual void verify_collection(); /** @brief cache connection */ CacheManager* cache = nullptr; /** @brief api connection */ PokemonTCGAPIClient* api = nullptr; /** @brief download manager */ DownloadManager* download_manager = nullptr; /** @brief allow api access from PokemonCard::fetch_market_value */ friend class PokemonCard; /** @brief search cache for cards matching query in id or name */ virtual std::vector search_cards_local(std::string query); /** @brief search API for cards matching query in id or name */ virtual std::vector search_cards_remote(std::string query); /** @brief [utility] convert std::string to lowercase */ std::string lower(std::string input); public: Pokedex(); virtual ~Pokedex(); /** @brief search cards that contain `query` in id or name field */ virtual std::vector search_cards(std::string query); /** @brief get card with specific id */ virtual PokemonCard* get_card_by_id(std::string id); };