#ifndef LOGINWIDGET_H
#define LOGINWIDGET_H

#include <QScopedPointer>
#include <QWidget>

#include <QScopedPointer>
#include <QWidget>

class LoginWidgetPrivate;
class LoginWidget : public QWidget
{
    Q_OBJECT
public:
    enum LayoutMode { LeftForm, RightForm, CenterForm };

    struct Config
    {
        bool showSocialButtons = false;
        bool allowFormCustomization = false;
        QString initialLanguage = "en_US";
        bool darkModeByDefault = false;
    };

    explicit LoginWidget(QWidget *parent = nullptr);
    ~LoginWidget();

    // 配置管理
    void setConfig(const Config &config);
    Config config() const;

    // 表单自定义接口
    void setCustomFormWidget(QWidget *widget);
    QWidget *takeCustomFormWidget();
    QWidget *formWidget() const;

signals:
    void loginRequested(const QString &username, const QString &password);
    void wechatLoginRequested();
    void githubLoginRequested();

protected:
    void resizeEvent(QResizeEvent *event) override;
    void changeEvent(QEvent *event) override;
    void showEvent(QShowEvent *event) override;

private:
    QScopedPointer<LoginWidgetPrivate> d_ptr;
    Q_DECLARE_PRIVATE(LoginWidget)
    Q_DISABLE_COPY(LoginWidget)
};

#endif // LOGINWIDGET_H
