#include "ink.h"
#include <QColor>

Ink::Ink()
{
   inkColors = new QVector<QColor>();
}

InkTextOption Ink::getTextOption() const
{
    return textOption;
}

void Ink::setTextOption(const InkTextOption &value)
{
    textOption = value;
}

void Ink::addColor(int position, QColor color)
{
    inkColors->replace(position, color);
}

QColor Ink::getColor(int position)
{    
    return  inkColors->value(position);
}

void Ink::setNumberOfElements(int number)
{
    Interfaz::setNumberOfElements(number);
    int previousSize = inkColors->isEmpty() ? 0 : inkColors->size();

    for(int i =0; i < abs(numberOfElements - previousSize); i++)
    {
        if(numberOfElements < previousSize)
        {
            inkColors->removeAt(inkColors->size() -1);
        }
        else
        {
            inkColors->append(QColor("#e3e3e3"));
        }
    }
}



bool Ink::isComplete()
{
    return numberOfElements == inkColors->size();
}

QVector<QColor> *Ink::getInkColors() const
{
    return inkColors;
}

void Ink::createInkColors(int number)
{
    inkColors = new QVector<QColor>();
    setNumberOfElements(number);
}
