{
    "version": "2.0.0",
    "tasks": [
        // Copilot Chat
        {
            "label": "run (Copilot Chat)",
            "detail": "Run all copilot chat components",
            "group": "test",
            "dependsOn": ["run (CopilotChatWebApi)", "run (CopilotChatApp)"],
            "dependsOrder": "parallel"
        },
        // Copilot Setup
        {
            "label": "install (CopilotChatApp)",
            "detail": "Install all copilot chat app dependencies",
            "type": "shell",
            "group": "build",
            "command": "yarn",
            "presentation": {
                "echo": true,
                "reveal": "always",
                "showReuseMessage": false,
                "panel": "shared",
                "group": "buildTasks"
            },
            "options": {
                "cwd": "${workspaceFolder}/webapp"
            },
            "problemMatcher": []
        },
        {
            "label": "setup (Copilot Chat)",
            "detail": "Setup (like setting secrets) for copilot chat app and api",
            "group": "test",
            "dependsOn": ["GetSecret (AIService:Key)"],
            "dependsOrder": "sequence"
            // TODO -- add tasks for configuring environment variables
        },
        {
            "label": "GetSecret (AIService:Key)",
            "command": "dotnet",
            "type": "process",
            "args": ["user-secrets", "set", "AIService:Key", "${input:aiServiceSecret}"],
            "options": {
                "cwd": "${workspaceFolder}/webapi"
            }
        },
        // Copilot Chat App
        {
            "label": "build (CopilotChatApp)",
            "type": "shell",
            "group": "build",
            "command": "yarn build",
            "presentation": {
                "echo": true,
                "reveal": "always",
                "panel": "shared",
                "group": "buildTasks"
            },
            "options": {
                "cwd": "${workspaceFolder}/webapp"
            },
            "problemMatcher": []
        },
        {
            "label": "run (CopilotChatApp)",
            "type": "shell",
            "group": "test",
            "command": "yarn start",
            "presentation": {
                "reveal": "always",
                "panel": "shared",
                "group": "copilot"
            },
            "options": {
                "cwd": "${workspaceFolder}/webapp"
            }
        },
        // Copilot Chat Api
        {
            "label": "build (CopilotChatWebApi)",
            "command": "dotnet",
            "type": "process",
            "args": [
                "build",
                "${workspaceFolder}/webapi/CopilotChatWebApi.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary",
                "/property:DebugType=portable"
            ],
            "problemMatcher": "$msCompile",
            "group": "build"
        },
        {
            "label": "run (CopilotChatWebApi)",
            "command": "dotnet",
            "type": "process",
            "args": [
                "run",
                "--project",
                "${workspaceFolder}/webapi/CopilotChatWebApi.csproj"
            ],
            "problemMatcher": "$msCompile",
            "group": "test",
            "presentation": {
                "reveal": "always",
                "panel": "shared",
                "group": "copilot"
            }
        },
        {
            "label": "watch (CopilotChatWebApi)",
            "command": "dotnet",
            "type": "process",
            "args": [
                "watch",
                "run",
                "--project",
                "${workspaceFolder}/webapi/CopilotChatWebApi.csproj"
            ],
            "problemMatcher": "$msCompile",
            "group": "build"
        }
    ],
    "inputs": [
        {
            "id": "aiServiceSecret",
            "type": "promptString",
            "default": "",
            "description": "Enter a secret for Copilot Chat AIService:Key",
            "password": true
        }
    ]
}
