#pragma once

#include <QWidget>
#include <QPointer>
#include <QPushButton>
#include <QToolButton>
#include <QLabel>
#include <QHBoxLayout>

#include "../../services/user_service.h"

class UserRowWidget : public QWidget {
    Q_OBJECT
public:
    explicit UserRowWidget(const UserRecord& user, QWidget* parent = nullptr, bool showActions = true);

    const UserRecord& data() const { return m_user; }
    void updateData(const UserRecord& user);

signals:
    void changePasswordRequested(const QString& username);
    void deleteUserRequested(const QString& username);
    // Type and avatar actions removed per new requirements

private:
    UserRecord m_user;
    bool m_showActions;
    QPointer<QLabel> m_idLabel;
    QPointer<QLabel> m_usernameLabel;
    QPointer<QLabel> m_fullnameLabel;
    QPointer<QPushButton> m_btnPwd;
    QPointer<QToolButton> m_btnDelete;

    QString displayId(const QString& raw) const;
    void buildUi();
    void wire();
    void updateElision();

protected:
    void resizeEvent(QResizeEvent* event) override;
};
