#include "CatalogItem.h"

CatalogItem::CatalogItem(const std::string& key, const std::string& value)
    : m_key(key),
      m_keyLower(key),
      m_value(value),
      m_visible(true)
{
    // Create lowercase version of the key's value
    for (uint32_t idx = 0; idx < m_keyLower.size(); ++idx)
    {
        if ((m_keyLower.at(idx) >= 'A') && (m_keyLower.at(idx) <= 'Z'))
        {
            m_keyLower.at(idx) = (m_keyLower.at(idx) | 32);
        }
    }
}

CatalogItem::~CatalogItem()
{

}

bool CatalogItem::match(const std::string& criteria)
{
    return m_keyLower.find(criteria) != std::string::npos;
}