#ifndef COUNTRYDATA_H
#define COUNTRYDATA_H

#include <QString>
#include <QObject>
#include <odb/core.hxx>
#include <QSharedPointer>
#include <data/comboitem.h>

#include <QtCore/qglobal.h>

#if defined(COUNTRYREGISTER_LIBRARY)
#  define COUNTRYREGISTERSHARED_EXPORT Q_DECL_EXPORT
#else
#  define COUNTRYREGISTERSHARED_EXPORT Q_DECL_IMPORT
#endif


#pragma db object
class COUNTRYREGISTERSHARED_EXPORT CountryData : public ComboItem
{
    Q_OBJECT
    Q_PROPERTY(QString code2 READ code2 WRITE setCode2)
    Q_PROPERTY(QString code3 READ code3 WRITE setCode3)
    Q_PROPERTY(QString czechFullName READ czechFullName WRITE setCzechFullName)
    Q_PROPERTY(QString czechName READ czechName WRITE setCzechName)
    Q_PROPERTY(QString englishFullName READ englishFullName WRITE setEnglishFullName)
    Q_PROPERTY(QString englishName READ englishName WRITE setEnglishName)
public:
    Q_INVOKABLE explicit CountryData(QObject *parent = 0);

    int id() const;
    void setId(int id);

    QString code2() const;
    void setCode2(const QString &code2);

    QString code3() const;
    void setCode3(const QString &code3);

    QString czechFullName() const;
    void setCzechFullName(const QString &czechFullName);

    QString czechName() const;
    void setCzechName(const QString &czechName);

    QString englishFullName() const;
    void setEnglishFullName(const QString &englishFullName);

    QString englishName() const;
    void setEnglishName(const QString &englishName);

private:
    friend class odb::access;
#pragma db id auto
    int m_id;
    QString m_code2;
    QString m_code3;
    QString m_czechFullName;
    QString m_czechName;
    QString m_englishFullName;
    QString m_englishName;


    // ComboItem interface
public:
    bool eq(ComboItem *other);
    QString toString();
};

typedef QSharedPointer<CountryData> CountryDataPtr;

#endif // COUNTRYDATA_H
