/*
 * Copyright 2025 KylinSoft Co., Ltd.
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef CLOUDMODELITEM_H
#define CLOUDMODELITEM_H

#include <QWidget>
#include <QGSettings>
#include <QMouseEvent>
#include <QMenu>
#include <QLabel>
#include <QVariant>
#include <QToolButton>
#include <QHBoxLayout>

#include <aiconfig/modelconfig.h>

#define THEME_QT_SCHEMA  "org.ukui.style"

using namespace std;
using namespace kyai::config::model;

class ModelItem : public QWidget
{
    Q_OBJECT
public:
    explicit ModelItem(AiCapability capability, QString modelName,
                       bool isTrialAccount, QWidget *parent = nullptr);
    ~ModelItem();

    void showSelectedIcon(bool flag);
    bool isSelected();
    AiCapability getAICapability();
    QString getModelName();
    bool isTrialModel();

signals:
    void sigEdit(AiCapability capability, QString modelName);
    void sigDelete(AiCapability capability, QString modelName);

private slots:

private:
    void initLayout();
    void initNameLabel();
    void initMoreButton();
    void initSelectedIconLabel();
    void initMenu();

    QLabel *m_nameLabel = nullptr;        // 模型名称
    QToolButton *m_moreButton = nullptr;  // 更多
    QMenu *m_menu = nullptr;              // 菜单
    QLabel *m_selectedIconLabel = nullptr;// 已选择状态
    kyai::config::model::AiCapability m_capability;
    QString m_modelName;
    bool m_isTrialAccount;
};

#endif // CLOUDMODELITEM_H
