#pragma once

#include <QtWidgets/QMainWindow>
#include "ui_MainWindow.h"

class MainWindow : public QMainWindow
{
	Q_OBJECT

public:
	MainWindow(QWidget *parent = Q_NULLPTR);

private slots:
	void onModelPath();
	void onServicePath();
	void onWidgetPath();
	void onGenerate();

    /**
     * @brief onTableFilePath 生成数据库建表语句的文件存储的位置
     */
    void onTableFilePath();
    /**
     * @brief onExcelPath excel文件路径
     */
    void onExcelPath();
    /**
     * @brief onGenerateTable 生成数据库建表语句
     */
    void onGenerateTable();

private:
	void createModel(const QString &modelName, const QString &entityName);
	void createService(const QString &serviceName, const QString &entityName);
	void createWidget(const QString &widgetName, const QString &modelName, const QString &serviceName, const QString &entityName, const QString &name);
	void createMultipleWidget(const QString &widgetName, const QString &modelName, const QString &serviceName, const QString &entityName, const QString &name);

	QString readAll(const QString &filename);
	void write(const QString &filename, const QString &content);

private:
	Ui::MainWindowClass ui;
};
