#pragma once

#include <QWidget>
#include <QString>
#include <QVBoxLayout>

class CodeEditor;
class Settings;

// ---------------------------------------------------------------------------
// EditorTab – Widget placed inside each tab of the tab bar.
// Owns a CodeEditor for a single file.
// ---------------------------------------------------------------------------
class EditorTab : public QWidget
{
    Q_OBJECT

public:
    explicit EditorTab(const QString &filePath, Settings *settings, QWidget *parent = nullptr);

    QString     filePath() const;
    QString     fileName() const;
    CodeEditor *editor()   const;
    bool        isModified() const;

    bool        save();
    bool        saveAs();

private:
    QString      m_filePath;
    QVBoxLayout *m_layout = nullptr;
    CodeEditor  *m_editor = nullptr;
};
