{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://aka.ms/vscs-platform-json-schema",
    "type": "object",
    "title": "GitHub Codespaces Platform Info",
    "description": "The JSON schema to build/validate the GitHub Codespaces platform authorization payload.",
    "default": {},
    "examples": [],
    "required": [
        "partnerName",
        "managementPortalUrl",
        "codespaceToken",
        "name",
        "displayName",
        "user",
        "credentials",
        "codespaceId",
        "vscodeSettings"
    ],
    "additionalProperties": false,
    "properties": {
        "partnerName": {
            "$id": "#/properties/partnerName",
            "type": "string",
            "title": "partnerName",
            "description": "GitHub Codespaces unique partner name.",
            "default": ""
        },
        "managementPortalUrl": {
            "$id": "#/properties/managementPortalUrl",
            "type": "string",
            "title": "managementPortalUrl",
            "description": "Where to redirect to in case the credentials expire.",
            "default": "",
            "examples": [
                "https://foo.com/codespaces"
            ]
        },
        "defaultWorkspacePath": {
            "$id": "#/properties/defaultWorkspacePath",
            "type": "string",
            "title": "defaultWorkspacePath",
            "description": "A `folder` or `workspace file` to open as Codespace root by default. If not defined, open an MRU(most recently used) folder. Otherwise, fallback to default folder, which is usually the repository root.",
            "default": "/home/codespace/workspace",
            "examples": [
                "/home/codespace/workspace"
            ]
        },
        "codespaceToken": {
            "$id": "#/properties/codespaceToken",
            "type": "string",
            "title": "codespaceToken",
            "description": "The Codespace JWT token.",
            "default": ""
        },
        "credentials": {
            "$id": "#/properties/credentials",
            "type": "array",
            "title": "credentials",
            "description": "An explanation about the purpose of this instance.",
            "default": [],
            "examples": [
                [
                    {
                        "expiration": 10000000000000,
                        "token": "<git token>",
                        "host": "github.com",
                        "path": "/"
                    }
                ]
            ],
            "additionalItems": false,
            "items": {
                "anyOf": [
                    {
                        "$id": "#/properties/credentials/items/anyOf/0",
                        "type": "object",
                        "title": "Git Credentials",
                        "description": "Credentials to perform git operations.",
                        "default": {},
                        "examples": [
                            {
                                "expiration": 10000000000000,
                                "token": "git token",
                                "host": "github.com",
                                "path": "/"
                            }
                        ],
                        "required": [
                            "token",
                            "host"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "expiration": {
                                "$id": "#/properties/credentials/items/anyOf/0/properties/expiration",
                                "type": "integer",
                                "title": "expiration",
                                "description": "The expiration timestamp of the token. [UTC timestamp in milliseconds]",
                                "default": 0,
                                "examples": [
                                    10000000000000
                                ]
                            },
                            "token": {
                                "$id": "#/properties/credentials/items/anyOf/0/properties/token",
                                "type": "string",
                                "title": "token",
                                "description": "The token to perform git operations.",
                                "default": "",
                                "examples": [
                                    "<github token>"
                                ]
                            },
                            "host": {
                                "$id": "#/properties/credentials/items/anyOf/0/properties/host",
                                "type": "string",
                                "title": "host",
                                "description": "The host of the token. [https://www.git-scm.com/docs/gitcredentials]",
                                "default": "",
                                "examples": [
                                    "github.com"
                                ]
                            },
                            "path": {
                                "$id": "#/properties/credentials/items/anyOf/0/properties/path",
                                "type": "string",
                                "title": "path",
                                "description": "The path of the git token. Can be omitted or set to `*`. [https://www.git-scm.com/docs/gitcredentials]",
                                "default": "",
                                "examples": [
                                    "/"
                                ]
                            }
                        }
                    }
                ],
                "$id": "#/properties/credentials/items"
            }
        },
        "codespaceId": {
            "$id": "#/properties/codespaceId",
            "type": "string",
            "title": "codespaceId",
            "description": "The Codespace id (GUID).",
            "default": "",
            "examples": [
                "<codespace guid>"
            ]
        },
        "name": {
            "$id": "#/properties/name",
            "type": "string",
            "title": "Codespace name",
            "description": "Name of a Codespace",
            "examples": [
                "legomushroom-github-github-j4xvj463j569"
            ]
        },
        "displayName": {
            "$id": "#/properties/displayName",
            "type": "string",
            "title": "Codespace display name",
            "description": "Display name of a Codespace",
            "examples": [
                "curly guacamole",
                "crispy space bassoon",
                "solid space couscous"
            ]
        },
        "gitHubApiUrl": {
            "$id": "#/properties/gitHubApiUrl",
            "type": "string",
            "title": "gitHubApiUrl",
            "description": "The fully qualified url where the portal can talk back to to the GitHub API.",
            "default": "",
            "examples": [
                "https://api.github.com"
            ]
        },
        "featureFlags": {
            "$id": "#/properties/featureFlags",
            "type": "object",
            "title": "The featureFlags schema",
            "description": "A dictionary of codespace feature flags.",
            "default": {},
            "examples": [
                {
                    "example-pfs-name": "not real feature flags",
                    "example-enable-pfs": true,
                    "example-multi-threading": 5
                }
            ],
            "required": [],
            "properties": {},
            "additionalProperties": true,
            "uniqueItems": true,
            "readOnly": true
        },
        "user": {
            "$id": "#/properties/user",
            "type": "object",
            "title": "User",
            "description": "User data.",
            "examples": [
                {
                    "login": "legomushroom",
                    "avatarUrl": "https://avatars.githubusercontent.com/u/1478800?s=400&u=c83ff15adaed8caa5c664bb50860a56b903b578a&v=4",
                    "profileUrl": "https://github.com/legomushroom"
                }
            ],
            "required": [
                "login",
                "avatarUrl",
                "profileUrl"
            ],
            "additionalProperties": false,
            "properties": {
                "login": {
                    "$id": "#/properties/user/properties/login",
                    "type": "string",
                    "title": "Users username",
                    "description": "Username of a user",
                    "default": "",
                    "examples": [
                        "legomushroom"
                    ]
                },
                "avatarUrl": {
                    "$id": "#/properties/user/properties/avatarUrl",
                    "type": "string",
                    "title": "Users avatar url",
                    "description": "Avatar url of a user",
                    "default": "",
                    "examples": [
                        "https://avatars.githubusercontent.com/u/1478800?s=400&u=c83ff15adaed8caa5c664bb50860a56b903b578a&v=4"
                    ]
                },
                "profileUrl": {
                    "$id": "#/properties/user/properties/profileUrl",
                    "type": "string",
                    "title": "Users profile url",
                    "description": "Users profile url",
                    "default": "",
                    "examples": [
                        "https://github.com/legomushroom"
                    ]
                }
            }
        },
        "vscodeSettings": {
            "$id": "#/properties/vscodeSettings",
            "type": "object",
            "title": "vscodeSettings",
            "description": "An explanation about the purpose of this instance.",
            "default": {},
            "examples": [],
            "required": [],
            "additionalProperties": false,
            "properties": {
                "vscodeChannel": {
                    "$id": "#/properties/vscodeSettings/properties/vscodeChannel",
                    "type": "string",
                    "title": "vscodeChannel",
                    "description": "The VSCode dogfood channel.",
                    "default": "stable",
                    "enum": [
                        "stable",
                        "insider"
                    ],
                    "examples": [
                        "stable",
                        "insider"
                    ]
                },
                "loadingScreenThemeColor": {
                    "$id": "#/properties/vscodeSettings/properties/loadingScreenThemeColor",
                    "type": "string",
                    "title": "loadingScreenThemeColor",
                    "description": "The VSCode loading screen theme color.",
                    "default": "light",
                    "enum": [
                        "light",
                        "dark"
                    ],
                    "examples": [
                        "light",
                        "dark"
                    ]
                },
                "defaultSettings": {
                    "$id": "#/properties/vscodeSettings/properties/defaultSettings",
                    "type": "object",
                    "title": "defaultSettings",
                    "description": "The VSCode workbench settings.",
                    "default": {},
                    "examples": [
                        {
                            "workbench.colorTheme": "GitHub Light",
                            "window.zoomLevel": 0,
                            "workbench.activityBar.visible": true
                        }
                    ],
                    "required": [],
                    "additionalProperties": true,
                    "properties": {}
                },
                "defaultExtensions": {
                    "$id": "#/properties/vscodeSettings/properties/defaultExtensions",
                    "type": "array",
                    "title": "defaultExtensions",
                    "description": "The list of the VSCode extensions to preinstall.",
                    "default": [],
                    "examples": [
                        [
                            {
                                "id": "GitHub.vscode-pull-request-github"
                            },
                            {
                                "id": "ms-vsliveshare.vsliveshare"
                            }
                        ]
                    ],
                    "additionalItems": true,
                    "items": {
                        "anyOf": [
                            {
                                "$id": "#/properties/vscodeSettings/properties/defaultExtensions/items/anyOf/0",
                                "type": "object",
                                "title": "VSCode extension",
                                "description": "Extension id.",
                                "default": {},
                                "examples": [
                                    {
                                        "id": "GitHub.vscode-pull-request-github"
                                    }
                                ],
                                "required": [
                                    "id"
                                ],
                                "additionalProperties": false,
                                "properties": {
                                    "id": {
                                        "$id": "#/properties/vscodeSettings/properties/defaultExtensions/items/anyOf/0/properties/id",
                                        "type": "string",
                                        "title": "id",
                                        "description": "VSCode extension id",
                                        "default": "",
                                        "examples": [
                                            "GitHub.vscode-pull-request-github"
                                        ]
                                    },
                                    "kind": {
                                        "$id": "#/properties/vscodeSettings/properties/defaultExtensions/items/anyOf/0/properties/type",
                                        "type": "string",
                                        "enum": [
                                            "ui",
                                            "workspace",
                                            "web"
                                        ],
                                        "title": "type",
                                        "description": "Type of the VSCode extension.",
                                        "default": "",
                                        "examples": [
                                            "ui",
                                            "workspace",
                                            "web"
                                        ]
                                    }
                                }
                            }
                        ],
                        "$id": "#/properties/vscodeSettings/properties/defaultExtensions/items"
                    }
                },
                "defaultAuthSessions": {
                    "$id": "#/properties/vscodeSettings/properties/defaultAuthSessions",
                    "type": "array",
                    "title": "defaultAuthSessions",
                    "description": "Default sessions for the built-in VSCode Auth Provider.",
                    "default": [],
                    "examples": [
                        [
                            {
                                "type": "github",
                                "id": "github-session-github-pr",
                                "accessToken": "<github token>",
                                "scopes": [
                                    "read:user",
                                    "user:email",
                                    "repo"
                                ],
                                "account": {
                                    "id": "some-id",
                                    "label": "legomushroom"
                                }
                            }
                        ]
                    ],
                    "additionalItems": true,
                    "items": {
                        "anyOf": [
                            {
                                "$id": "#/properties/vscodeSettings/properties/defaultAuthSessions/items/anyOf/0",
                                "type": "object",
                                "title": "VSCode default auth session",
                                "description": "A VSCode Auth Provider session.",
                                "default": {},
                                "examples": [
                                    {
                                        "type": "github",
                                        "id": "github-session-github-pr",
                                        "accessToken": "<github token>",
                                        "scopes": [
                                            "read:user",
                                            "user:email",
                                            "repo"
                                        ],
                                        "account": {
                                            "id": "some-id",
                                            "label": "legomushroom"
                                        }
                                    }
                                ],
                                "required": [
                                    "type",
                                    "id",
                                    "accessToken",
                                    "scopes"
                                ],
                                "additionalProperties": false,
                                "properties": {
                                    "type": {
                                        "$id": "#/properties/vscodeSettings/properties/defaultAuthSessions/items/anyOf/0/properties/type",
                                        "type": "string",
                                        "title": "type",
                                        "description": "Id of the auth provider.",
                                        "default": "",
                                        "examples": [
                                            "github",
                                            "microsoft",
                                            "<custom one>"
                                        ]
                                    },
                                    "id": {
                                        "$id": "#/properties/vscodeSettings/properties/defaultAuthSessions/items/anyOf/0/properties/id",
                                        "type": "string",
                                        "title": "id",
                                        "description": "The id of the session.",
                                        "default": "",
                                        "examples": [
                                            "<guid>"
                                        ]
                                    },
                                    "accessToken": {
                                        "$id": "#/properties/vscodeSettings/properties/defaultAuthSessions/items/anyOf/0/properties/accessToken",
                                        "type": "string",
                                        "title": "accessToken",
                                        "description": "The session access token.",
                                        "default": "",
                                        "examples": [
                                            "<github token>"
                                        ]
                                    },
                                    "scopes": {
                                        "$id": "#/properties/vscodeSettings/properties/defaultAuthSessions/items/anyOf/0/properties/scopes",
                                        "type": "array",
                                        "title": "scopes",
                                        "description": "List of the permission scopes the token was issued with.",
                                        "default": [],
                                        "examples": [
                                            [
                                                "read:user",
                                                "user:email"
                                            ]
                                        ],
                                        "additionalItems": true,
                                        "items": {
                                            "anyOf": [
                                                {
                                                    "$id": "#/properties/vscodeSettings/properties/defaultAuthSessions/items/anyOf/0/properties/scopes/items/anyOf/0",
                                                    "type": "string",
                                                    "title": "Token Scope",
                                                    "description": "A token permission scope.",
                                                    "default": "",
                                                    "examples": [
                                                        "read:user",
                                                        "user:email"
                                                    ]
                                                }
                                            ],
                                            "$id": "#/properties/vscodeSettings/properties/defaultAuthSessions/items/anyOf/0/properties/scopes/items"
                                        }
                                    },
                                    "account": {
                                        "$id": "#/properties/vscodeSettings/properties/defaultAuthSessions/items/anyOf/0/properties/account",
                                        "type": "object",
                                        "title": "Account information",
                                        "description": "Account information",
                                        "default": {},
                                        "examples": [
                                            {
                                                "id": "some-id",
                                                "label": "legomushroom"
                                            }
                                        ],
                                        "required": [
                                            "id"
                                        ],
                                        "additionalProperties": false,
                                        "properties": {
                                            "id": {
                                                "$id": "/properties/vscodeSettings/properties/defaultAuthSessions/items/anyOf/0/properties/account/properties/id",
                                                "type": "string",
                                                "title": "id",
                                                "description": "Account id.",
                                                "default": "",
                                                "examples": [
                                                    "1478800"
                                                ]
                                            },
                                            "label": {
                                                "$id": "/properties/vscodeSettings/properties/defaultAuthSessions/items/anyOf/0/properties/account/properties/label",
                                                "type": "string",
                                                "title": "label",
                                                "description": "Account label.",
                                                "default": "",
                                                "examples": [
                                                    "legomushroom"
                                                ]
                                            }
                                        }
                                    }
                                }
                            }
                        ],
                        "$id": "#/properties/vscodeSettings/properties/defaultAuthSessions/items"
                    }
                }
            }
        },
        "connectionInfo": {
            "$id": "#/properties/connectionInfo",
            "type": "object",
            "title": "The connectionInfo schema",
            "description": "An explanation about the purpose of this instance.",
            "default": {},
            "examples": [],
            "required": [
                "sessionId",
                "relaySas",
                "relayEndpoint",
                "sessionToken",
                "hostPublicKeys",
                "serviceUri"
            ],
            "additionalProperties": false,
            "properties": {
                "sessionId": {
                    "$id": "#/properties/connectionInfo/properties/sessionId",
                    "type": "string",
                    "title": "The connection session id",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "000000000000000000000000000000000000"
                    ]
                },
                "relaySas": {
                    "$id": "#/properties/connectionInfo/properties/relaySas",
                    "type": "string",
                    "title": "The Relay SAS token",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "<relay token>"
                    ]
                },
                "relayEndpoint": {
                    "$id": "#/properties/connectionInfo/properties/relayEndpoint",
                    "type": "string",
                    "title": "The Relay endpoint",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "sb://<relay>.servicebus.windows.net/<id>"
                    ]
                },
                "sessionToken": {
                    "$id": "#/properties/connectionInfo/properties/sessionToken",
                    "type": "string",
                    "title": "The session Cascade token",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "<session token>"
                    ]
                },
                "hostPublicKeys": {
                    "$id": "#/properties/connectionInfo/properties/hostPublicKeys",
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "title": "The host public keys",
                    "description": "An explanation about the purpose of this instance.",
                    "default": [],
                    "examples": [
                        [
                            "<public key 1>",
                            "<public key 2>"
                        ]
                    ]
                },
                "serviceUri": {
                    "$id": "#/properties/connectionInfo/properties/serviceUri",
                    "type": "string",
                    "title": "The liveshare service",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "https://insiders.liveshare.vsengsaas.visualstudio.com",
                        "https://ppe.liveshare.vsengsaas.visualstudio.com"
                    ]
                }
            }
        }
    }
}