#ifndef PARSER_H
#define PARSER_H
#include <Model/interfaz.h>
#include <Model/menu.h>
#include <Model/information.h>
#include <Model/ink.h>
#include <QString>

#define ROOT_WIDTH "ROOT_WIDTH"
#define ROOT_HEIGHT "ROOT_HEIGHT"
#define BACKGROUND "BACKGROUND"
#define COLOR "BACKGROUND_COLOR"
#define IMAGE "IMAGE"
#define NUMBER_ROWS "NUMBER_ROWS"
#define NUMBER_COLS "NUMBER_COLS"
#define LIST_ELEMENT "ELEMENTS"
#define ORIENTATION "ORIENTATION"
#define VERTICAL "Qt.Vertical"
#define HORIZONTAL "Qt.Horizontal"

#define ICON_NAME "ICON_NAME"
#define CARD_ICON "CARD_ICON"
#define CARD_ICON_VIEW "ICONS_VIEW"
#define CARD_INDEX "CARD_INDEX"
#define CARD_TITLE "CARD_TITLE"
#define CARD_PROPERTY "CARD_PROPERTY"
#define CARD_VIEW_PROPERTY "CARD_VIEW_PROPERTY"
#define PROPERTY_INDEX "PROPERTY_INDEX"
#define PROPERTY_RECT "PROPERTY_RECT"
#define PROPERTY_NAME "PROPERTY_NAME"
#define VALUE_INDEX "VALUE_INDEX"
#define PROPERTY_VALUE "PROPERTY_VALUE"
#define PROPERTY_VIEW_INDEX "PROPERTY_VIEW_INDEX"
#define VALUE_VIEW_INDEX "VALUE_VIEW_INDEX"
#define TOP_POSITION "TOP_POSITION"
#define LEFT_POSITION "LEFT_POSITION"
#define RELATIVE_POSITION "RELATIVE_POSITION"
#define FONT_SIZE "FONT_SIZE"

#define SEPARATOR "separator"
#define PARENT "parent"
#define IMAGE_ID "icon"


#define CUSTOMIZE_SIZE "CUSTOMIZE_SIZE"
#define CUSTOMIZE_SIZE_VIEW "CUSTOMIZE_SIZE_VIEW"
#define HEADER_MARGIN "TOP_MARGIN"
#define BOTTOM_MARGIN "BOTTOM_MARGIN"
#define LEFT_MARGIN "LEFT_MARGIN"
#define RIGHT_MARGIN "RIGHT_MARGIN"

/*!
 * \brief The Parser class. Creates QML files by app inteface models.
 */
class Parser
{
private: 

    /*!
     * \brief setSizeProperties Speficies QML size properties.
     * \param source source Partial QML generated file.
     * \param interfaz Interface to be converted into QML file.
     * \return Generated QML file with size properties.
     */
    QString setSizeProperties(QString source, Interfaz *interfaz);

    /*!
     * \brief setBackGroundProperties Specifies QML background properties.
     * \param source source Partial QML generated file.
     * \param interfaz Interface to be converted into QML file.
     * \return Generated QML file with background properties.
     */
    QString setBackGroundProperties(QString source, Interfaz *interfaz);

    /*!
     * \brief getTemplateSource Obtains the partial QML templates.
     * \param path QML template path.
     * \return QML template.
     */
    QString getTemplateSource(QString path);

    /*!
     * \brief saveResult Saves the QML file into the speficied system path.
     * \param result QML file to be saved.
     * \param pathToSave System path to save the file.
     */
    void saveResult(QString result, QString pathToSave);

    /*!
     * \brief formProperty Creates QML information screen property.
     * \param propertyIndex Index of the property.
     * \param property Information property.
     * \return Generated QML file with the information property.
     */
    QString formProperty(int propertyIndex, QStringList property);

    /*!
     * \brief formInformationElement Creates QML information screen option.
     * \param card Card to be converted.
     * \return Generated QML file with card information.
     */
    QString formInformationElement(Card *card);

    /*!
     * \brief formInformationViewElement Creates QML information screen view option.
     * \param interfaz Interface to be converted into QML file.
     * \return Generated QML file with information view elements.
     */
    QString formInformationViewElement(Information *interfaz);

    /*!
     * \brief inkTextOption Creates QML ink screen text view option.
     * \param source Partial QML generated file.
     * \param textOption Ink text option.
     * \return Generated QML file with ink text option.
     */
    QString inkTextOption(QString source, InkTextOption textOption);

public:

    /*!
     * \brief Parser constructor.
     */
    Parser();

    /*!
     * \brief parse Create QML file by menu model interface.
     * \param interfaz Interface to convert into QML file.
     * \param path Path to save the generated file.
     */
    void parse(Menu *interfaz, QString path);

    /*!
     * \brief parse Create QML file by information model interface.
     * \param interfaz Interface to convert into QML file.
     * \param path Path to save the generated file.
     */
    void parse(Information *interfaz, QString path);

    /*!
     * \brief parse Create QML file by ink model interface.
     * \param interfaz Interface to convert into QML file.
     * \param path Path to save the generated file.
     */
    void parse(Ink *interfaz, QString path);

};

#endif // PARSER_H
