#ifndef USERINFOITEM_H
#define USERINFOITEM_H

#include <QObject>
#include <QDBusInterface>
#include <QMenu>
#include <QIcon>

namespace UkuiMenu {
class UserInfoItemPrivate;
class UserInfoItem : public QObject
{
    Q_OBJECT

public:
    explicit UserInfoItem(QString objectPath, QObject *parent = nullptr);
    ~UserInfoItem() = default;

    void initUserInfo();
    void createCircularIcon();

    bool isCurrentUser() {return m_isCurrentUser;};
    bool isLogged() {return m_isLogged;};
    bool autoLogin() {return m_autoLogin;};
    bool noPwdLogin() {return m_noPwdLogin;};

    int accountType() {return m_accountType;};
    int passwdType() {return m_passwdType;};
    qint64 uid() {return m_uid;};

    QString objPath() {return m_objPath;};
    QString userName() {return m_userName;};
    QString realName() {return m_realName;};
    QString iconFile() {return m_iconFile;};
    QString passwd() {return m_passwd;};
    QIcon circularIcon() {return m_circularIcon;};


private Q_SLOTS:
    void userInfoUpdateSlot(const QString &property, const QMap<QString, QVariant> &propertyMap,
                            const QStringList &propertyList);

Q_SIGNALS:
    void userInfoChanged();

private:
    QString m_objectPath;
    UserInfoItemPrivate *d = nullptr;

    bool m_isCurrentUser;
    bool m_isLogged;
    bool m_autoLogin;
    bool m_noPwdLogin;

    int m_accountType;
    int m_passwdType;
    qint64 m_uid;

    QString m_objPath;
    QString m_userName;
    QString m_realName;
    QString m_iconFile;
    QString m_passwd;
    QIcon m_circularIcon;
};
}

#endif // USERINFOITEM_H
