#ifndef EDITOR_H
#define EDITOR_H

#include <QObject>
#include <QQuickItem>
#include <Model/interfaz.h>

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

    /*!
     * \brief edit Constructs an interface model by the path of QML file.
     * \param interfaz QML file path which contains the interface.
     * \return The created interface if the data was right, nullptr otherwise.
     */
    static Interfaz* edit(QString file);

    /*!
     * \brief getType Returns the interface type.
     * \return Type of the interface.
     */
    static int getType();

    /*!
     * \brief getErrorList Returns the list errors of the last operation.
     * \return Error list.
     */
    static QStringList* getErrorList();

private:   

    /*!
     * \brief edit Constructs an interface model by the object of QML file.
     * \param interfaz Object represents the file QML who contains the \a interfaz.
     * \return The created interface if the data was right, nullptr otherwise.
     */
    static Interfaz* edit(QObject *interfaz);

    /**
     * @brief getType Obtains the type of the QML interface represented by \a myobject
     * @param myobject Object of the QML file.
     * @return Type of the interface.
     */
    static int getType(QObject *myobject);

    /*!
     * \brief getBackground Obtains background options of the interface.
     * \param interfaz Interface to set the background option.
     * \param objectLoaded Item which represents the QML file.
     */
    static void getBackground(Interfaz *interfaz, QQuickItem *objectLoaded);    

    /*!
     * \brief ink Contructs an ink interface by the \a ink item.
     * \param interfaz Interface to set ink screen values.
     * \param ink Item which represents the QML file.
     */
    static void ink(Interfaz *interfaz, QQuickItem *ink);

    /*!
     * \brief menu Contructs an menu interface by the \a menu item.
     * \param interfaz Interface to set information screen values.
     * \param menu Item which represents the QML file.
     */
    static void menu(Interfaz *interfaz, QQuickItem *menu);

    /*!
     * \brief information Contructs an information interface by the \a information item.
     * \param interfazInterface to set information screen values.
     * \param information Item which represents the QML file.
     */
    static void information(Interfaz *interfaz, QQuickItem *information);

    /*!
     * \brief fileExist Checks if the file exist in the system.
     * \param path To be checked.
     * \return \c True if the file exist in the system, \c false otherwise.
     */
    static bool fileExist(const QString path);

private:

    /*!
     * \brief errorList Errors found during the process.
     */
    static QStringList *errorList;

    /*!
     * \brief type Type of the interface.
     */
    static int type;
};

#endif // EDITOR_H
