#include "SpellFilter.h"

SpellFilter::SpellFilter()
    : _levelFilter(-1)
    , _ritualFilter(-1)
    , _concentrationFilter(-1)
{}

void SpellFilter::setNameFilter(QString nameFilter)
{
    _nameFilter = nameFilter;
}

QString SpellFilter::nameFilter() const
{
    return _nameFilter;
}

bool SpellFilter::hasNameFilter() const
{
    return !_nameFilter.isEmpty();
}

void SpellFilter::setSchoolFilter(QString schoolFilter)
{
    if(schoolFilter == "Any")
    {
        _schoolFilter = "";
    }
    else
    {
        _schoolFilter = schoolFilter;
    }
}

QString SpellFilter::schoolFilter() const
{
    return _schoolFilter;
}

bool SpellFilter::hasSchoolFilter() const
{
    return !_schoolFilter.isEmpty();
}

void SpellFilter::setLevelFilter(QString levelFilter)
{
    if(levelFilter == "Any")
    {
        _levelFilter = -1;
    }
    else
    {
        _levelFilter = levelFilter.toInt();
    }
}

int SpellFilter::levelFilter() const
{
    return _levelFilter;
}

bool SpellFilter::hasLevelFilter() const
{
    return _levelFilter != -1;
}

void SpellFilter::setClassFilter(QString classFilter)
{
    if(classFilter == "Any")
    {
        _classFilter = "";
    }
    else
    {
        _classFilter = classFilter;
    }
}

QString SpellFilter::classFilter() const
{
    return _classFilter;
}

bool SpellFilter::hasClassFilter() const
{
    return !_classFilter.isEmpty();
}

void SpellFilter::setRitualFilter(int state)
{
    if(state == 1)
    {
        _ritualFilter = -1;
    }
    else if(state == 0)
    {
        _ritualFilter = 0;
    }
    else
    {
        _ritualFilter = 1;
    }
}

bool SpellFilter::ritualFilter() const
{
    return _ritualFilter == 1;
}

bool SpellFilter::hasRitualFilter() const
{
    return _ritualFilter != -1;
}

void SpellFilter::setConcentrationFilter(int state)
{
    if(state == 1)
    {
        _concentrationFilter = -1;
    }
    else if(state == 0)
    {
        _concentrationFilter = 0;
    }
    else
    {
        _concentrationFilter = 1;
    }
}

bool SpellFilter::concentrationFilter() const
{
    return _concentrationFilter == 1;
}

bool SpellFilter::hasConcentrationFilter() const
{
    return _concentrationFilter != -1;
}

void SpellFilter::setVocalFilter(int state)
{
    if(state == 1)
    {
        _vocalFilter = -1;
    }
    else if(state == 0)
    {
        _vocalFilter = 0;
    }
    else
    {
        _vocalFilter = 1;
    }
}

bool SpellFilter::vocalFilter() const
{
    return _vocalFilter == 1;
}

bool SpellFilter::hasVocalFilter() const
{
    return _vocalFilter != -1;
}

void SpellFilter::setSomaticFilter(int state)
{
    if(state == 1)
    {
        _somaticFilter = -1;
    }
    else if(state == 0)
    {
        _somaticFilter = 0;
    }
    else
    {
        _somaticFilter = 1;
    }
}

bool SpellFilter::somaticFilter() const
{
    return _somaticFilter == 1;
}

bool SpellFilter::hasSomaticFilter() const
{
    return _somaticFilter != -1;
}

void SpellFilter::setMaterialFilter(int state)
{
    if(state == 1)
    {
        _materialFilter = -1;
    }
    else if(state == 0)
    {
        _materialFilter = 0;
    }
    else
    {
        _materialFilter = 1;
    }
}

bool SpellFilter::materialFilter() const
{
    return _materialFilter == 1;
}

bool SpellFilter::hasMaterialFilter() const
{
    return _materialFilter != -1;
}

void SpellFilter::setMaterialExpensiveFilter(int state)
{
    if(state == 1)
    {
        _materialExpensiveFilter = -1;
    }
    else if(state == 0)
    {
        _materialExpensiveFilter = 0;
    }
    else
    {
        _materialExpensiveFilter = 1;
    }
}

bool SpellFilter::materialExpensiveFilter() const
{
    return _materialExpensiveFilter == 1;
}

bool SpellFilter::hasMaterialExpensiveFilter() const
{
    return _materialExpensiveFilter != -1;
}

void SpellFilter::setMaterialConsumedFilter(int state)
{
    if(state == 1)
    {
        _materialConsumedFilter = -1;
    }
    else if(state == 0)
    {
        _materialConsumedFilter = 0;
    }
    else
    {
        _materialConsumedFilter = 1;
    }
}

bool SpellFilter::materialConsumedFilter() const
{
    return _materialConsumedFilter == 1;
}

bool SpellFilter::hasMaterialConsumedFilter() const
{
    return _materialConsumedFilter != -1;
}
