{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Develop and serve Frontend",
      "type": "shell",
      "command": "script/develop_and_serve -c ${input:coreUrl}",
      // Sync changes here to other tasks until issue resolved
      // https://github.com/Microsoft/vscode/issues/61497
      "problemMatcher": {
        "owner": "ha-build",
        "source": "ha-build",
        "fileLocation": "absolute",
        "severity": "error",
        "pattern": [
          {
            "regexp": "(SyntaxError): (.+): (.+) \\((\\d+):(\\d+)\\)",
            "severity": 1,
            "file": 2,
            "message": 3,
            "line": 4,
            "column": 5
          }
        ],
        "background": {
          "activeOnStart": true,
          "beginsPattern": "Changes detected. Starting compilation",
          "endsPattern": "Build done @"
        }
      },
      "isBackground": true,
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "runOptions": {
        "instanceLimit": 1
      }
    },
    {
      "label": "Develop Frontend",
      "type": "gulp",
      "task": "develop-app",
      // Sync changes here to other tasks until issue resolved
      // https://github.com/Microsoft/vscode/issues/61497
      "problemMatcher": {
        "owner": "ha-build",
        "source": "ha-build",
        "fileLocation": "absolute",
        "severity": "error",
        "pattern": [
          {
            "regexp": "(SyntaxError): (.+): (.+) \\((\\d+):(\\d+)\\)",
            "severity": 1,
            "file": 2,
            "message": 3,
            "line": 4,
            "column": 5
          }
        ],
        "background": {
          "activeOnStart": true,
          "beginsPattern": "Changes detected. Starting compilation",
          "endsPattern": "Build done @"
        }
      },
      "isBackground": true,
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "runOptions": {
        "instanceLimit": 1
      }
    },
    {
      "label": "Develop Supervisor panel",
      "type": "gulp",
      "task": "develop-hassio",
      "problemMatcher": {
        "owner": "ha-build",
        "source": "ha-build",
        "fileLocation": "absolute",
        "severity": "error",
        "pattern": [
          {
            "regexp": "(SyntaxError): (.+): (.+) \\((\\d+):(\\d+)\\)",
            "severity": 1,
            "file": 2,
            "message": 3,
            "line": 4,
            "column": 5
          }
        ],
        "background": {
          "activeOnStart": true,
          "beginsPattern": "Changes detected. Starting compilation",
          "endsPattern": "Build done @"
        }
      },
      "isBackground": true,
      "group": "build",
      "runOptions": {
        "instanceLimit": 1
      }
    },
    {
      "label": "Develop Gallery",
      "type": "gulp",
      "task": "develop-gallery",
      "problemMatcher": {
        "owner": "ha-build",
        "source": "ha-build",
        "fileLocation": "absolute",
        "severity": "error",
        "pattern": [
          {
            "regexp": "(SyntaxError): (.+): (.+) \\((\\d+):(\\d+)\\)",
            "severity": 1,
            "file": 2,
            "message": 3,
            "line": 4,
            "column": 5
          }
        ],
        "background": {
          "activeOnStart": true,
          "beginsPattern": "Changes detected. Starting compilation",
          "endsPattern": "Build done @"
        }
      },

      "isBackground": true,
      "group": "build",
      "runOptions": {
        "instanceLimit": 1
      }
    },
    {
      "label": "Develop Landing Page",
      "type": "gulp",
      "task": "develop-landing-page",
      "problemMatcher": {
        "owner": "ha-build",
        "source": "ha-build",
        "fileLocation": "absolute",
        "severity": "error",
        "pattern": [
          {
            "regexp": "(SyntaxError): (.+): (.+) \\((\\d+):(\\d+)\\)",
            "severity": 1,
            "file": 2,
            "message": 3,
            "line": 4,
            "column": 5
          }
        ],
        "background": {
          "activeOnStart": true,
          "beginsPattern": "Changes detected. Starting compilation",
          "endsPattern": "Build done @"
        }
      },

      "isBackground": true,
      "group": "build",
      "runOptions": {
        "instanceLimit": 1
      }
    },
    {
      "label": "Develop Demo",
      "type": "gulp",
      "task": "develop-demo",
      "problemMatcher": {
        "owner": "ha-build",
        "source": "ha-build",
        "fileLocation": "absolute",
        "severity": "error",
        "pattern": [
          {
            "regexp": "(SyntaxError): (.+): (.+) \\((\\d+):(\\d+)\\)",
            "severity": 1,
            "file": 2,
            "message": 3,
            "line": 4,
            "column": 5
          }
        ],
        "background": {
          "activeOnStart": true,
          "beginsPattern": "Changes detected. Starting compilation",
          "endsPattern": "Build done @"
        }
      },

      "isBackground": true,
      "group": "build",
      "runOptions": {
        "instanceLimit": 1
      }
    },
    {
      "label": "Develop Cast",
      "type": "gulp",
      "task": "develop-cast",
      "problemMatcher": {
        "owner": "ha-build",
        "source": "ha-build",
        "fileLocation": "absolute",
        "severity": "error",
        "pattern": [
          {
            "regexp": "(SyntaxError): (.+): (.+) \\((\\d+):(\\d+)\\)",
            "severity": 1,
            "file": 2,
            "message": 3,
            "line": 4,
            "column": 5
          }
        ],
        "background": {
          "activeOnStart": true,
          "beginsPattern": "Changes detected. Starting compilation",
          "endsPattern": "Build done @"
        }
      },

      "isBackground": true,
      "group": "build",
      "runOptions": {
        "instanceLimit": 1
      }
    },
    {
      "label": "Run HA Core in devcontainer",
      "type": "shell",
      "command": "script/core",
      "isBackground": true,
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "problemMatcher": [],
      "runOptions": {
        "instanceLimit": 1
      }
    },
    {
      "label": "Run HA Core for Supervisor in devcontainer",
      "type": "shell",
      "command": "SUPERVISOR=${input:supervisorHost} SUPERVISOR_TOKEN=${input:supervisorToken} script/core",
      "isBackground": true,
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "problemMatcher": [],
      "runOptions": {
        "instanceLimit": 1
      }
    },
    {
      "label": "Setup and fetch nightly translations",
      "type": "gulp",
      "task": "setup-and-fetch-nightly-translations",
      "problemMatcher": []
    }
  ],
  "inputs": [
    {
      "id": "supervisorHost",
      "type": "promptString",
      "description": "The IP of the Supervisor host running the Remote API proxy add-on"
    },
    {
      "id": "supervisorToken",
      "type": "promptString",
      "description": "The token for the Remote API proxy add-on"
    },
    {
      "id": "coreUrl",
      "type": "promptString",
      "description": "The URL of the Home Assistant Core instance",
      "default": "http://127.0.0.1:8123"
    }
  ]
}
