{
    "version": 1,
    "supportedProjectTypes": [ "PythonProject" ],
    "id": "F.QtForPythonApplicationWindowWidget",
    "category": "F.ApplicationPySide",
    "trDescription": "Creates a Qt for Python application that includes a Qt Widgets Designer-based widget (ui file). Requires .ui to Python conversion.",
    "trDisplayName": "Window UI",
    "trDisplayCategory": "Application (Qt for Python)",
    "icon": "../icons/icon.png",
    "iconKind": "Themed",
    "enabled": "%{JS: isPluginRunning('python') && (!value('Platform').length || ['Desktop', 'DockerDeviceType', 'GenericLinuxOsType'].includes(value('Platform')))}",

    "options":
    [
        { "key": "SrcFileName", "value": "%{MainFileName}" },
        { "key": "PyProjectTomlFile", "value": "pyproject.toml" },
        { "key": "ProjectFilePath", "value": "%{ProjectDirectory}/%{PyProjectTomlFile}" }
    ],

    "pages":
    [
        {
            "trDisplayName": "Project Location",
            "trShortTitle": "Location",
            "typeId": "Project",
            "name": "ProjectPath"
        },
        {
            "trDisplayName": "Define Class",
            "trShortTitle": "Details",
            "typeId": "Fields",
            "data" :
            [
                {
                    "name": "Class",
                    "trDisplayName": "Class name:",
                    "mandatory": true,
                    "type": "LineEdit",
                    "data":
                    {
                        "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)",
                        "text": "%{JS: value('BaseCB') ? value('BaseCB').slice(1) : 'MyClass'}"
                    }

                },
                {
                    "name": "BaseCB",
                    "trDisplayName": "Base class:",
                    "type": "ComboBox",
                    "data":
                    {
                        "items": [ "QWidget", "QDialog", "QMainWindow" ]
                    }
                },
                {
                    "name": "MainFileName",
                    "type": "LineEdit",
                    "trDisplayName": "Source file:",
                    "mandatory": true,
                    "data": { "text": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-python'))}" }
                }
            ]
        },
        {
            "trDisplayName": "Define Python Interpreter",
            "trShortTitle": "Interpreter",
            "typeId": "PythonConfiguration",
            "data":
            {
                "index": 0,
                "items":
                [
                    {
                        "trKey": "PySide 6",
                        "value":
                        {
                            "PySideVersion": "PySide6"
                        }
                    }
                ]
            }
        },
        {
            "trDisplayName": "Kit Selection",
            "trShortTitle": "Kits",
            "typeId": "Kits",
            "data": {
                 "projectFilePath": "%{ProjectFilePath}",
                 "requiredFeatures": [ "Python.Interpreter" ]
            }
        },
        {
            "trDisplayName": "Project Management",
            "trShortTitle": "Summary",
            "typeId": "Summary"
        }
    ],
    "generators":
    [
        {
            "typeId": "File",
            "data":
            [
                {
                    "source": "pyproject.toml",
                    "target": "%{PyProjectTomlFile}",
                    "openAsProject": true
                },
                {
                    "source": "../main_widget.py",
                    "target": "%{SrcFileName}",
                    "openInEditor": true
                },
                {
                    "source": "../main_widget.ui",
                    "target": "form.ui"
                },
                {
                    "source": "../requirements.txt",
                    "target": "requirements.txt"
                },
                {
                    "source": "../../git.ignore",
                    "target": ".gitignore",
                    "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
                }
            ]
        }
    ]
}
