{
  "openapi": "3.0.4",
  "info": {
    "title": "Application API",
    "version": "v1"
  },
  "paths": {
    "/Auth/login": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "Starts the interactive login flow.",
        "description": "If the caller is already authenticated, they are redirected to the frontend\ntenant-selector page. Otherwise an OpenID Connect challenge is issued which\nredirects the browser to Okta to sign in. This endpoint is anonymous and is\nintended to be navigated to by a browser, not called via AJAX.",
        "responses": {
          "302": {
            "description": "Redirects either to the Okta login page or, when already authenticated, to the frontend tenant selector."
          }
        }
      }
    },
    "/Auth/logout": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "Signs the current user out of both the local cookie session and Okta.",
        "description": "Clears the authentication cookie and initiates the OpenID Connect sign-out,\nthen redirects the browser back to the configured frontend URL.",
        "responses": {
          "302": {
            "description": "Redirects to Okta to complete sign-out and then back to the frontend."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Chat/message": {
      "post": {
        "tags": [
          "Chat"
        ],
        "summary": "Send a message. Auto-resolves session: uses latest existing or creates one.",
        "description": "The message is forwarded to the AI agent for the current user's active session.\nIf no session exists yet, one is resolved/created automatically. The returned\ntext is the consent-filtered display message.",
        "requestBody": {
          "description": "The chat request containing the user's `Message` to send to the agent.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.ChatMessageRequestDTO"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.ChatMessageRequestDTO"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.ChatMessageRequestDTO"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The agent's reply, formatted for display.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.ChatResponseDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.ChatResponseDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.ChatResponseDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Chat/sessions": {
      "get": {
        "tags": [
          "Chat"
        ],
        "summary": "List all sessions for the current user, ordered newest first.",
        "description": "Returns the user's chat sessions sorted by most recent update time descending.",
        "responses": {
          "200": {
            "description": "The list of chat sessions for the current user.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.SessionDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.SessionDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.SessionDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Chat"
        ],
        "summary": "Create a new session and make it active.",
        "description": "Creates a fresh chat session for the current user and sets it as the active\nsession so subsequent messages are routed to it.",
        "responses": {
          "200": {
            "description": "The identifier of the newly created, now-active session.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.SessionResponseDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.SessionResponseDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.SessionResponseDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Chat/sessions/{sessionId}": {
      "post": {
        "tags": [
          "Chat"
        ],
        "summary": "Set a session as active.",
        "description": "Marks the specified session as the current user's active session without\nloading its history.",
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "description": "The identifier of the session to activate.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The identifier of the now-active session.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.SessionResponseDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.SessionResponseDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.SessionResponseDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Chat"
        ],
        "summary": "Get full session detail including chat history events.",
        "description": "Retrieves the full detail (including message/event history) for the specified\nsession and also sets it as the active session.",
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "description": "The identifier of the session to retrieve.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The full session detail including its chat history.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.SessionDetailDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.SessionDetailDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.SessionDetailDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/deployment-region": {
      "get": {
        "tags": [
          "DeploymentRegion"
        ],
        "summary": "Returns the environment and region of this Application deployment.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Controllers.DeploymentRegionResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Controllers.DeploymentRegionResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Controllers.DeploymentRegionResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/host-applications": {
      "get": {
        "tags": [
          "HostApplications"
        ],
        "summary": "List all host applications (e.g., GitHub, Gitea)",
        "description": "Returns every host application in the catalog, ordered by ID. Host applications\nare shared across all tenants; each tenant configures its own OAuth credentials separately.",
        "responses": {
          "200": {
            "description": "The list of host applications was returned successfully.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.Entities.Application"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.Entities.Application"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.Entities.Application"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "HostApplications"
        ],
        "summary": "Create a new host application (e.g., register GitHub as an available integration)",
        "description": "Registers a new host application in the catalog. The name is required and must be\nunique (case-insensitive); duplicate names are rejected.",
        "requestBody": {
          "description": "The details of the host application to create.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.Controllers.CreateHostApplicationRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.Controllers.CreateHostApplicationRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.Controllers.CreateHostApplicationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The host application was created successfully.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.Application"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.Application"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.Application"
                }
              }
            }
          },
          "400": {
            "description": "The name is missing or a host application with the same name already exists.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/host-applications/{id}": {
      "get": {
        "tags": [
          "HostApplications"
        ],
        "summary": "Get a specific host application by ID",
        "description": "Looks up a single host application using its numeric identifier.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The numeric identifier of the host application.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The host application was found and returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.Application"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.Application"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.Application"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No host application exists with the given ID.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "HostApplications"
        ],
        "summary": "Update a host application",
        "description": "Updates the mutable fields of an existing host application. When a new name is\nsupplied it must not collide (case-insensitive) with another application.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The numeric identifier of the host application to update.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The fields to update on the host application.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.Controllers.UpdateHostApplicationRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.Controllers.UpdateHostApplicationRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.Controllers.UpdateHostApplicationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The host application was updated successfully.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.Application"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.Application"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.Application"
                }
              }
            }
          },
          "400": {
            "description": "The supplied name conflicts with an existing host application.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No host application exists with the given ID.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "HostApplications"
        ],
        "summary": "Delete a host application (only if no tenants are using it)",
        "description": "Permanently removes a host application from the catalog.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The numeric identifier of the host application to delete.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The host application was deleted successfully."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No host application exists with the given ID.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/host-applications/by-name/{name}": {
      "get": {
        "tags": [
          "HostApplications"
        ],
        "summary": "Get a specific host application by name",
        "description": "Performs a case-insensitive lookup of a host application by its name (e.g., \"github\").",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "description": "The name of the host application (case-insensitive).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The host application was found and returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.Application"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.Application"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.Application"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No host application exists with the given name.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/oauth/initiate/gitea": {
      "get": {
        "tags": [
          "OAuth"
        ],
        "summary": "Step 1: redirect the user to Gitea's OAuth authorization page.",
        "description": "GET /api/oauth/initiate/gitea. Generates a CSRF `state` value, stores it in the session,\nand issues a redirect to Gitea's authorization endpoint. Requires the \"gitea\" host application\nto be configured in the database.",
        "responses": {
          "302": {
            "description": "Redirect to Gitea's OAuth authorization page."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "The Gitea application is not configured in the database.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/oauth/initiate/github": {
      "get": {
        "tags": [
          "OAuth"
        ],
        "summary": "Step 1: redirect the user to GitHub's OAuth authorization page.",
        "description": "GET /api/oauth/initiate/github. Generates a CSRF `state` value, stores it in the session,\nand issues a redirect to GitHub's authorization endpoint. Requires the \"github\" host application\nto be configured in the database.",
        "responses": {
          "302": {
            "description": "Redirect to GitHub's OAuth authorization page."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "The GitHub application is not configured in the database.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/oauth/initiate/jira": {
      "get": {
        "tags": [
          "OAuth"
        ],
        "summary": "Step 1: redirect the user to Atlassian's (Jira) OAuth 2.0 (3LO) authorization page.",
        "description": "GET /api/oauth/initiate/jira. Generates a CSRF `state` value, stores it in the session,\nand issues a redirect to Atlassian's authorization endpoint (requesting `offline_access` so a\nrefresh token is returned). Requires the \"jira\" host application to be configured in the database.",
        "responses": {
          "302": {
            "description": "Redirect to Atlassian's (Jira) OAuth authorization page."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "The Jira application is not configured in the database.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/oauth/initiate/confluence": {
      "get": {
        "tags": [
          "OAuth"
        ],
        "summary": "Step 1: redirect the user to Atlassian's (Confluence) OAuth 2.0 (3LO) authorization page.",
        "description": "GET /api/oauth/initiate/confluence. Generates a CSRF `state` value, stores it in the session,\nand issues a redirect to Atlassian's authorization endpoint (requesting `offline_access` so a\nrefresh token is returned). Requires the \"confluence\" host application to be configured in the database.",
        "responses": {
          "302": {
            "description": "Redirect to Atlassian's (Confluence) OAuth authorization page."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "The Confluence application is not configured in the database.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/oauth/callback/gitea": {
      "get": {
        "tags": [
          "OAuth"
        ],
        "summary": "Step 2: Gitea redirects back here with ?code=...&state=...",
        "description": "GET /api/oauth/callback/gitea. Validates the `state` against the session, exchanges the\nauthorization `code` for tokens, persists the consent/token secret references, and redirects\nback to the frontend (success or error URL).",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "description": "The authorization code returned by Gitea.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "The CSRF state value to validate against the session.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "error",
            "in": "query",
            "description": "Optional error code returned by Gitea when authorization failed.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect back to the frontend (success or error URL)."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/oauth/callback/github": {
      "get": {
        "tags": [
          "OAuth"
        ],
        "summary": "Step 2: GitHub redirects back here with ?code=...&state=...",
        "description": "GET /api/oauth/callback/github. Validates the `state` against the session, exchanges the\nauthorization `code` for tokens, persists the consent/token secret references, and redirects\nback to the frontend (success or error URL).",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "description": "The authorization code returned by GitHub.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "The CSRF state value to validate against the session.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "error",
            "in": "query",
            "description": "Optional error code returned by GitHub when authorization failed.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect back to the frontend (success or error URL)."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/oauth/callback/jira": {
      "get": {
        "tags": [
          "OAuth"
        ],
        "summary": "Step 2: Atlassian (Jira) redirects back here with ?code=...&state=...",
        "description": "GET /api/oauth/callback/jira. Validates the `state` against the session, exchanges the\nauthorization `code` at Atlassian's token endpoint (JSON body), persists the consent/token\nsecret references, and redirects back to the frontend (success or error URL).",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "description": "The authorization code returned by Atlassian.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "The CSRF state value to validate against the session.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "error",
            "in": "query",
            "description": "Optional error code returned by Atlassian when authorization failed.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect back to the frontend (success or error URL)."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/oauth/callback/confluence": {
      "get": {
        "tags": [
          "OAuth"
        ],
        "summary": "Step 2: Atlassian (Confluence) redirects back here with ?code=...&state=...",
        "description": "GET /api/oauth/callback/confluence. Validates the `state` against the session, exchanges the\nauthorization `code` at Atlassian's token endpoint (JSON body), persists the consent/token\nsecret references, and redirects back to the frontend (success or error URL).",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "description": "The authorization code returned by Atlassian.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "The CSRF state value to validate against the session.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "error",
            "in": "query",
            "description": "Optional error code returned by Atlassian when authorization failed.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect back to the frontend (success or error URL)."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/okta/users/{userId}/groups": {
      "get": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Get the Okta groups a user belongs to.",
        "description": "Returns the list of Okta groups the specified user is a member of.",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "description": "The Okta user identifier.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The user's groups were returned."
          },
          "400": {
            "description": "The request to Okta failed.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/okta/users": {
      "get": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Get the list of Okta users in the \"user\" role.",
        "description": "Retrieves users from Okta using a backend service account (not the caller's token).",
        "responses": {
          "200": {
            "description": "The list of users was returned."
          },
          "400": {
            "description": "The request to Okta failed.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Create a new Okta user.",
        "description": "Creates a new user in Okta with the supplied profile details.",
        "requestBody": {
          "description": "The new user's profile details.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.Controllers.OktaAPIsController+CreateUserRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.Controllers.OktaAPIsController+CreateUserRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.Controllers.OktaAPIsController+CreateUserRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The user was created and returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Okta.OktaUserDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Okta.OktaUserDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Okta.OktaUserDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/okta/groups": {
      "get": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Get the list of Okta groups.",
        "description": "Retrieves groups from Okta using a backend service account (not the caller's token).",
        "responses": {
          "200": {
            "description": "The list of groups was returned."
          },
          "400": {
            "description": "The request to Okta failed.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/okta/groups/{groupId}": {
      "get": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Get the details of a specific Okta group.",
        "description": "Retrieves a single group by ID. Access is validated against the current tenant.",
        "parameters": [
          {
            "name": "groupId",
            "in": "path",
            "description": "The Okta group identifier.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The group details were returned."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The group is not accessible for the current tenant, or the caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error occurred while contacting Okta."
          }
        }
      }
    },
    "/okta/groups/{groupId}/users": {
      "get": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Get the users belonging to a specific Okta group.",
        "description": "Retrieves the members of a group by ID. Access is validated against the current tenant.",
        "parameters": [
          {
            "name": "groupId",
            "in": "path",
            "description": "The Okta group identifier.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The group members were returned."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The group is not accessible for the current tenant, or the caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error occurred while contacting Okta."
          }
        }
      }
    },
    "/okta/groups/{groupId}/apps": {
      "get": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Get the applications assigned to a specific Okta group.",
        "description": "Retrieves the apps assigned to a group by ID. Access is validated against the current tenant.",
        "parameters": [
          {
            "name": "groupId",
            "in": "path",
            "description": "The Okta group identifier.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The group's applications were returned."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The group is not accessible for the current tenant, or the caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error occurred while contacting Okta."
          }
        }
      }
    },
    "/okta/apps": {
      "get": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Get the list of Okta applications.",
        "description": "Retrieves apps from Okta using a backend service account.",
        "responses": {
          "200": {
            "description": "The list of applications was returned."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/okta/{groupId}/users/{userId}": {
      "put": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Add a user to an Okta group.",
        "description": "Adds the specified user to the specified group. Access is validated against the current tenant.",
        "parameters": [
          {
            "name": "groupId",
            "in": "path",
            "description": "The Okta group identifier.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "description": "The Okta user identifier.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The user was added to the group."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The group is not accessible for the current tenant, or the caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error occurred while contacting Okta."
          }
        }
      },
      "delete": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Remove a user from an Okta group.",
        "description": "Removes the specified user from the specified group. Access is validated against the current tenant.",
        "parameters": [
          {
            "name": "groupId",
            "in": "path",
            "description": "The Okta group identifier.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "description": "The Okta user identifier.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The user was removed from the group."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The group is not accessible for the current tenant, or the caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error occurred while contacting Okta."
          }
        }
      }
    },
    "/okta/users/my-profile/is-tenant-admin": {
      "get": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Check whether the current session's user is a tenant administrator.",
        "description": "Returns whether the current user belongs to the tenant's \"admin\" role.",
        "responses": {
          "200": {
            "description": "The admin status was returned."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "Access to the required group was denied, or the caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "An unexpected error occurred while contacting Okta."
          }
        }
      }
    },
    "/okta/users/add-tenant/{userId}": {
      "post": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Assign one or more tenants to an Okta user.",
        "description": "Adds the supplied tenants to the user's tenant scopes. Tenants already assigned are ignored,\nand the response reports how many were added versus ignored.",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "description": "The Okta user identifier.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The tenants to assign to the user.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Okta.TenantRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Okta.TenantRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Okta.TenantRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tenants were processed; the response reports added and ignored counts."
          },
          "400": {
            "description": "The request to Okta was rejected as a bad request.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The operation is not permitted, or the caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "The user was not found in Okta.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "The request to Okta failed unexpectedly."
          }
        }
      }
    },
    "/okta/users/remove-tenant/{userId}": {
      "post": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Remove one or more tenants from an Okta user.",
        "description": "Removes the supplied tenants from the user's tenant scopes.",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "description": "The Okta user identifier.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The tenants to remove from the user.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Okta.TenantRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Okta.TenantRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Okta.TenantRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tenants were removed successfully."
          },
          "400": {
            "description": "The request to Okta was rejected as a bad request.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The operation is not permitted, or the caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "The user was not found in Okta.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "The request to Okta failed unexpectedly."
          }
        }
      }
    },
    "/okta/v1/logs": {
      "get": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Get the Okta system log for the current tenant.",
        "description": "Returns the raw Okta system log entries for the current tenant as JSON content.",
        "responses": {
          "200": {
            "description": "The logs were returned as JSON content."
          },
          "400": {
            "description": "The request to Okta failed.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/okta/v2/logs": {
      "get": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Get the Okta system log for the current tenant.",
        "description": "Returns the raw Okta system log entries for the current tenant as JSON content.",
        "parameters": [
          {
            "name": "keyword",
            "in": "query",
            "description": "Optional free-text search query.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "event_type",
            "in": "query",
            "description": "Optional filter expression like \"user.session.start\"",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "since",
            "in": "query",
            "description": "Optional start date/time in format YYYY-MM-DD HH:mm:ss.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "until",
            "in": "query",
            "description": "Optional end date/time in format YYYY-MM-DD HH:mm:ss.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "next_page",
            "in": "query",
            "description": "Optional pagination cursor returned from a previous request.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Optional maximum number of events to return.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The logs were returned as JSON content."
          },
          "400": {
            "description": "The request to Okta failed.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/okta/users/reset-password/{userId}": {
      "post": {
        "tags": [
          "OktaAPIs"
        ],
        "summary": "Trigger an Okta password reset for a user.",
        "description": "Sends a password reset email to the specified user via Okta.",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "description": "The Okta user identifier.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The password reset email was sent successfully."
          },
          "400": {
            "description": "The request to Okta failed.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "The user was not found in Okta.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/token-exchange": {
      "get": {
        "tags": [
          "TokenExchange"
        ],
        "summary": "Silently exchanges the caller's current token for a token scoped to the\nrequested tenant.",
        "description": "The caller must already be authenticated (via cookie or bearer token) and the\nrequested tenant must be present in the user's `tenants` claims. On success\na prompt-less (`prompt=none`) OpenID Connect challenge is issued that adds\nthe `tenant:<tenantId>` scope and redirects to the supplied URI.",
        "parameters": [
          {
            "name": "tenantId",
            "in": "query",
            "description": "The target tenant identifier to switch into. Case-insensitive; trimmed and lower-cased.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "RedirectUri",
            "in": "query",
            "description": "The URI the browser is redirected to after the silent challenge completes.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirects to the identity provider to silently obtain the tenant-scoped token."
          },
          "400": {
            "description": "The tenant id is missing, or the token contains no tenant claims.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated or no access token was found.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              }
            }
          },
          "403": {
            "description": "The authenticated user does not have access to the requested tenant.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              }
            }
          }
        }
      }
    },
    "/Tokens/claims": {
      "get": {
        "tags": [
          "Tokens"
        ],
        "summary": "Get the current identity's claims and derived email information.",
        "description": "Diagnostic endpoint that returns all claims on the current principal along with the\nresolved user email, authentication type and authentication status. Useful for debugging\ncookie vs. JWT bearer authentication.",
        "responses": {
          "200": {
            "description": "The claims and identity information were returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.UserClaimsDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.UserClaimsDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.UserClaimsDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Tokens/access-token": {
      "get": {
        "tags": [
          "Tokens"
        ],
        "summary": "Get the current session's OAuth access token.",
        "description": "Returns the access token issued for the current session, or a placeholder when none is present.",
        "responses": {
          "200": {
            "description": "The access token (or a placeholder string) was returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.TokenResponseDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.TokenResponseDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.TokenResponseDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Tokens/id-token": {
      "get": {
        "tags": [
          "Tokens"
        ],
        "summary": "Get the current session's OIDC id token.",
        "description": "Returns the id token issued for the current session, or a placeholder when none is present.",
        "responses": {
          "200": {
            "description": "The id token (or a placeholder string) was returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.TokenResponseDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.TokenResponseDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.TokenResponseDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Tokens/applications": {
      "get": {
        "tags": [
          "Tokens"
        ],
        "summary": "Get all applications",
        "description": "Returns every tenant OAuth application configured for the current tenant.",
        "responses": {
          "200": {
            "description": "The list of applications was returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.Entities.TenantApplication"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.Entities.TenantApplication"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.Entities.TenantApplication"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Tokens"
        ],
        "summary": "Create new application",
        "description": "Creates a new tenant OAuth application. When Secret Manager writes are enabled, the client\nsecret is written to Secret Manager; only its generated secret name is persisted in the database.",
        "requestBody": {
          "description": "The application details, including the client secret to store.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.CreateApplicationDTO"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.CreateApplicationDTO"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.CreateApplicationDTO"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The application was created successfully.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.TenantApplication"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.TenantApplication"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.TenantApplication"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Tokens/applications/{id}": {
      "get": {
        "tags": [
          "Tokens"
        ],
        "summary": "Get application by ID",
        "description": "Looks up a single tenant application by its numeric identifier.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The numeric identifier of the application.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The application was found and returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.TenantApplication"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.TenantApplication"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.TenantApplication"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No application exists with the given ID.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Tokens"
        ],
        "summary": "Update application (PATCH method - only provided fields are updated)",
        "description": "Partially updates an existing tenant application; only the fields supplied in the body are changed.\nIf a new client secret is provided, it is written to Secret Manager and the secret name is updated.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The numeric identifier of the application to update.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The subset of application fields to update.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.UpdateApplicationDTO"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.UpdateApplicationDTO"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.UpdateApplicationDTO"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The application was updated and the result returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.TenantApplication"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.TenantApplication"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.TenantApplication"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No application exists with the given ID.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Tokens"
        ],
        "summary": "Delete application by ID",
        "description": "Permanently deletes a tenant application by its numeric identifier.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The numeric identifier of the application to delete.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The application was deleted successfully."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No application exists with the given ID.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Tokens/applications/by-client/{clientId}": {
      "get": {
        "tags": [
          "Tokens"
        ],
        "summary": "Get application by client ID",
        "description": "Looks up a single tenant application by its OAuth client identifier.",
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "description": "The OAuth client identifier of the application.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The application was found and returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.TenantApplication"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.TenantApplication"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.TenantApplication"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No application exists with the given client ID.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Tokens/integrations": {
      "get": {
        "tags": [
          "Tokens"
        ],
        "summary": "Get the current user's available integrations.",
        "description": "Resolves the current user's email from the cookie or JWT and returns the integrations\navailable to them.",
        "responses": {
          "200": {
            "description": "The list of integrations was returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.DTO.IntegrationDTO"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.DTO.IntegrationDTO"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.DTO.IntegrationDTO"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The user email could not be resolved from the request claims.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              }
            }
          }
        }
      }
    },
    "/Tokens/my-consents": {
      "get": {
        "tags": [
          "Tokens"
        ],
        "summary": "Get current user's consents (automatically detects user from cookie or JWT)",
        "description": "Returns every explicit consent granted by the current user across all applications.",
        "responses": {
          "200": {
            "description": "The list of consents was returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.Entities.ExplicitConsent"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.Entities.ExplicitConsent"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.Entities.ExplicitConsent"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The user email could not be resolved from the request claims.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              }
            }
          }
        }
      }
    },
    "/Tokens/my-consents/application/{applicationId}": {
      "get": {
        "tags": [
          "Tokens"
        ],
        "summary": "Get consent for specific application (automatically detects user from cookie or JWT)",
        "description": "Returns the current user's consent for a single application, if one exists.",
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "description": "The numeric identifier of the application.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The consent was found and returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.ExplicitConsent"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.ExplicitConsent"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.ExplicitConsent"
                }
              }
            }
          },
          "401": {
            "description": "The user email could not be resolved from the request claims.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              }
            }
          },
          "404": {
            "description": "The current user has no consent for the given application.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Tokens/grant-consent": {
      "post": {
        "tags": [
          "Tokens"
        ],
        "summary": "Grant consent for application with token (automatically detects user from cookie or JWT)",
        "description": "Records the current user's consent for an application and stores the supplied token secrets.\nWhen `ExpiresInDays` is omitted, a default expiry window is applied.",
        "requestBody": {
          "description": "The consent details, including application ID and token secret references.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Agent.GrantConsentDTO"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Agent.GrantConsentDTO"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Agent.GrantConsentDTO"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Consent was granted and the created consent details returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Agent.ConsentWithDetailsDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Agent.ConsentWithDetailsDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Agent.ConsentWithDetailsDTO"
                }
              }
            }
          },
          "401": {
            "description": "The user email could not be resolved from the request claims.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              }
            }
          }
        }
      }
    },
    "/Tokens/external/consents/application/{applicationId}": {
      "get": {
        "tags": [
          "Tokens"
        ],
        "summary": "Get user's consent for specific application (for external API calls - requires explicit userEmail)",
        "description": "External variant that does not derive the user from the request; the target user's email\nmust be supplied explicitly as a query parameter.",
        "parameters": [
          {
            "name": "applicationId",
            "in": "path",
            "description": "The numeric identifier of the application.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "userEmail",
            "in": "query",
            "description": "The email of the user whose consent should be returned.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The consent was found and returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.ExplicitConsent"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.ExplicitConsent"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.ExplicitConsent"
                }
              }
            }
          },
          "400": {
            "description": "The `userEmail` query parameter was not supplied.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "The specified user has no consent for the given application.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Tokens/consents/{consentId}": {
      "delete": {
        "tags": [
          "Tokens"
        ],
        "summary": "Revoke consent (works with both auth types)",
        "description": "Revokes a previously granted consent by its identifier.",
        "parameters": [
          {
            "name": "consentId",
            "in": "path",
            "description": "The numeric identifier of the consent to revoke.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The consent was revoked successfully."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No consent exists with the given ID.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              }
            }
          }
        }
      }
    },
    "/Tokens/consents/{consentId}/status": {
      "patch": {
        "tags": [
          "Tokens"
        ],
        "summary": "Update consent status (works with both auth types)",
        "description": "Enables or disables a consent by updating its granted flag.",
        "parameters": [
          {
            "name": "consentId",
            "in": "path",
            "description": "The numeric identifier of the consent to update.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The new consent status.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Agent.UpdateConsentStatusDTO"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Agent.UpdateConsentStatusDTO"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Agent.UpdateConsentStatusDTO"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "The consent status was updated successfully."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No consent exists with the given ID.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Tokens/tokens/{tokenId}": {
      "put": {
        "tags": [
          "Tokens"
        ],
        "summary": "Update token (works with both auth types)",
        "description": "Updates the stored token/refresh-token secret references and expiry for a token row.\nWhen `ExpiresInDays` is omitted, a default expiry window is applied.",
        "parameters": [
          {
            "name": "tokenId",
            "in": "path",
            "description": "The numeric identifier of the token to update.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "The new token secret references and optional expiry window.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.UpdateTokenDTO"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.UpdateTokenDTO"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.UpdateTokenDTO"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "The token was updated successfully."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant administrator.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No token exists with the given ID.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Tokens"
        ],
        "summary": "Get token by ID (works with both auth types)",
        "description": "Looks up a single third-party token by its numeric identifier.",
        "parameters": [
          {
            "name": "tokenId",
            "in": "path",
            "description": "The numeric identifier of the token.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The token was found and returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.ThirdPartyToken"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.ThirdPartyToken"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.Entities.ThirdPartyToken"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No token exists with the given ID.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Tokens/tokens/{tokenId}/is-expired": {
      "get": {
        "tags": [
          "Tokens"
        ],
        "summary": "Check if token is expired (works with both auth types)",
        "description": "Returns whether the referenced token has passed its expiry date.",
        "parameters": [
          {
            "name": "tokenId",
            "in": "path",
            "description": "The numeric identifier of the token to check.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The expiry status was returned.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.TokenExpiredDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.TokenExpiredDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.TokenExpiredDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/WhoAmI": {
      "get": {
        "tags": [
          "WhoAmI"
        ],
        "summary": "Returns the profile of the currently authenticated user, aggregated from the\navailable identity claims.",
        "description": "Reads claims (name, email, title, organization, tenants, etc.) issued by the\nidentity provider and returns a normalized user summary. No request body or\nparameters are required; the caller must present a valid authentication cookie\nor bearer token.",
        "responses": {
          "200": {
            "description": "The authenticated user's profile and associated tenants."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/WhoAmI/session": {
      "get": {
        "tags": [
          "WhoAmI"
        ],
        "summary": "Returns the remaining lifetime of the session's access token.",
        "description": "Used by the frontend keep-alive to observe the silent refresh: hitting this endpoint\nruns the cookie validation pipeline, which renews the tokens when they are close to\nexpiry, and reports how long the current access token is still valid.",
        "responses": {
          "200": {
            "description": "The current session token status."
          },
          "401": {
            "description": "The caller is not authenticated or the session expired.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/WhoAmI/current-tenant": {
      "get": {
        "tags": [
          "WhoAmI"
        ],
        "summary": "Returns details about the tenant resolved for the current request.",
        "description": "Reports the active tenant id, name and availability. When no tenant is resolved\nthe response indicates the host (no tenant) context.",
        "responses": {
          "200": {
            "description": "The current tenant context information."
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/WorkstationRequests/options": {
      "get": {
        "tags": [
          "WorkstationRequests"
        ],
        "summary": "Returns the name prefix and available configurations for the request form.",
        "description": "Provides the data needed to render the request form: the workstation name prefix and\nthe list of configurations the user may choose from. Available to any authenticated user.",
        "responses": {
          "200": {
            "description": "The options used to populate the request form.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestOptionsDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestOptionsDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestOptionsDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/WorkstationRequests": {
      "post": {
        "tags": [
          "WorkstationRequests"
        ],
        "summary": "Submits a new workstation request for the current user.",
        "description": "Creates a pending workstation request for the signed-in user. A user may only have a\nlimited number of pending requests; exceeding it returns a conflict.",
        "requestBody": {
          "description": "The details of the workstation request to create.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.CreateWorkstationRequestDTO"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.CreateWorkstationRequestDTO"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.CreateWorkstationRequestDTO"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The newly created workstation request.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "The user has exceeded the allowed number of pending requests.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.ErrorMessageDTO"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "WorkstationRequests"
        ],
        "summary": "Lists requests in the current tenant, optionally filtered by category\n(`all` (default), `pending`, `approved`, `declined`, `closed`).\nAdmin only.",
        "description": "Restricted to tenant (Okta) admins. Only requests stored in the current tenant's\ndatabase are returned.",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "description": "Optional status filter: `all` (default), `pending`, `approved`,\n`declined`, or `closed`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The matching workstation requests.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant admin.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/WorkstationRequests/mine": {
      "get": {
        "tags": [
          "WorkstationRequests"
        ],
        "summary": "Lists the current user's own requests.",
        "description": "Returns every workstation request submitted by the signed-in user in the current tenant.",
        "responses": {
          "200": {
            "description": "The current user's workstation requests.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/WorkstationRequests/{id}/approve": {
      "post": {
        "tags": [
          "WorkstationRequests"
        ],
        "summary": "Approves a pending request. Admin only.",
        "description": "Restricted to tenant (Okta) admins. Marks the specified pending request as approved.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The identifier of the workstation request to approve.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The approved workstation request.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant admin.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No request matches the supplied identifier.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/WorkstationRequests/{id}/decline": {
      "post": {
        "tags": [
          "WorkstationRequests"
        ],
        "summary": "Declines a pending request with an optional reason. Admin only.",
        "description": "Restricted to tenant (Okta) admins. Marks the specified pending request as declined,\noptionally recording a reason supplied in the body.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The identifier of the workstation request to decline.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "description": "Optional payload carrying the reason for declining the request.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.DeclineWorkstationRequestDTO"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.DeclineWorkstationRequestDTO"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.DeclineWorkstationRequestDTO"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The declined workstation request.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a tenant admin.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No request matches the supplied identifier.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Workstations": {
      "get": {
        "tags": [
          "Workstations"
        ],
        "summary": "Lists all configurations and workstations in the current tenant's cluster so the\nuser can select which configuration to work with.",
        "description": "Runs server-side with the backend service account and returns every workstation\nconfiguration in the tenant's cluster along with the workstations under each one.",
        "responses": {
          "200": {
            "description": "The overview of configurations and their workstations.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationsOverviewDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationsOverviewDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationsOverviewDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Workstations/{configId}/{workstationId}": {
      "get": {
        "tags": [
          "Workstations"
        ],
        "summary": "Gets a single workstation (used by the frontend to poll state).",
        "description": "Returns the current state of the requested workstation. The frontend calls this\nrepeatedly to track transitions (for example, STARTING to RUNNING).",
        "parameters": [
          {
            "name": "configId",
            "in": "path",
            "description": "The identifier of the workstation configuration.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "workstationId",
            "in": "path",
            "description": "The identifier of the workstation within the configuration.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The requested workstation.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No workstation matches the supplied identifiers.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Workstations/{configId}/{workstationId}/start": {
      "post": {
        "tags": [
          "Workstations"
        ],
        "summary": "Starts a workstation. The workstation transitions to RUNNING asynchronously.",
        "description": "Requests the workstation to start and returns immediately; the workstation reaches\nthe RUNNING state asynchronously. Poll `GET {configId}/{workstationId}` to track it.",
        "parameters": [
          {
            "name": "configId",
            "in": "path",
            "description": "The identifier of the workstation configuration.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "workstationId",
            "in": "path",
            "description": "The identifier of the workstation to start.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The start operation was accepted; includes the host URL and state.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationStartResponseDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationStartResponseDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationStartResponseDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No workstation matches the supplied identifiers.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Workstations/{configId}/{workstationId}/stop": {
      "post": {
        "tags": [
          "Workstations"
        ],
        "summary": "Stops a workstation. The workstation transitions to STOPPED asynchronously.",
        "description": "Requests the workstation to stop and returns immediately; the workstation reaches\nthe STOPPED state asynchronously. Poll `GET {configId}/{workstationId}` to track it.",
        "parameters": [
          {
            "name": "configId",
            "in": "path",
            "description": "The identifier of the workstation configuration.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "workstationId",
            "in": "path",
            "description": "The identifier of the workstation to stop.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The stop operation was accepted; includes the updated state.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationStartResponseDTO"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationStartResponseDTO"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationStartResponseDTO"
                }
              }
            }
          },
          "401": {
            "description": "The caller is not authenticated.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "No workstation matches the supplied identifiers.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AEC.Backend.Application.Controllers.CreateHostApplicationRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The unique, case-insensitive name of the host application (e.g., \"github\", \"gitea\").",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Request payload for creating a new host application in the shared catalog."
      },
      "AEC.Backend.Application.Controllers.DeploymentRegionResponse": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "environment": {
            "type": "string",
            "nullable": true
          },
          "region": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Public identity of an Application deployment; unrelated to the Vertex AI location."
      },
      "AEC.Backend.Application.Controllers.OktaAPIsController+CreateUserRequest": {
        "type": "object",
        "properties": {
          "firstName": {
            "type": "string",
            "description": "The user's first (given) name.",
            "nullable": true
          },
          "lastName": {
            "type": "string",
            "description": "The user's last (family) name.",
            "nullable": true
          },
          "email": {
            "type": "string",
            "description": "The user's email address, also used as the Okta login.",
            "nullable": true
          },
          "mobilePhone": {
            "type": "string",
            "description": "The user's mobile phone number.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Request payload for creating a new Okta user."
      },
      "AEC.Backend.Application.Controllers.UpdateHostApplicationRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The new name for the host application. When supplied it must be unique (case-insensitive).",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Request payload for updating an existing host application. Omitted or empty fields are left unchanged."
      },
      "AEC.Backend.Application.DTO.AIChat.ChatMessageDTO": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "description": "Role of the message author, e.g. `user` or `model`.",
            "nullable": true
          },
          "parts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.PartDto"
            },
            "description": "The content parts that make up the message body.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A single chat message exchanged with the AI agent, composed of a role and one or more\ncontent parts. Appears within session detail responses."
      },
      "AEC.Backend.Application.DTO.AIChat.ChatMessageRequestDTO": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "The message text the caller wants to send to the agent. Required.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Request payload carrying a user's message to send to the AI agent."
      },
      "AEC.Backend.Application.DTO.AIChat.ChatResponseDTO": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "description": "The text of the agent's response.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Response payload containing the AI agent's reply text."
      },
      "AEC.Backend.Application.DTO.AIChat.PartDto": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "description": "The text content of this part.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A single content part of a chat message."
      },
      "AEC.Backend.Application.DTO.AIChat.SessionDetailDTO": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier of the session.",
            "nullable": true
          },
          "userId": {
            "type": "string",
            "description": "Identifier of the user who owns the session.",
            "nullable": true
          },
          "appName": {
            "type": "string",
            "description": "Name of the agent application the session belongs to.",
            "nullable": true
          },
          "lastUpdateTime": {
            "type": "number",
            "description": "Time the session was last updated, as a Unix epoch timestamp (seconds).",
            "format": "double"
          },
          "state": {
            "description": "Arbitrary session state maintained by the agent.",
            "nullable": true
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.SessionEventDto"
            },
            "description": "The ordered list of events (messages) that occurred in the session.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Response payload with the full detail of an AI chat session, including its state and\nthe ordered list of events (messages) it contains."
      },
      "AEC.Backend.Application.DTO.AIChat.SessionDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier of the session.",
            "nullable": true
          },
          "userId": {
            "type": "string",
            "description": "Identifier of the user who owns the session.",
            "nullable": true
          },
          "appName": {
            "type": "string",
            "description": "Name of the agent application the session belongs to.",
            "nullable": true
          },
          "lastUpdateTime": {
            "type": "number",
            "description": "Time the session was last updated, as a Unix epoch timestamp (seconds).",
            "format": "double"
          }
        },
        "additionalProperties": false,
        "description": "Response payload summarizing an AI chat session."
      },
      "AEC.Backend.Application.DTO.AIChat.SessionEventDto": {
        "type": "object",
        "properties": {
          "author": {
            "type": "string",
            "description": "Author of the event, e.g. the user or the agent.",
            "nullable": true
          },
          "timestamp": {
            "type": "number",
            "description": "Time the event occurred, as a Unix epoch timestamp (seconds).",
            "format": "double"
          },
          "id": {
            "type": "string",
            "description": "Unique identifier of the event.",
            "nullable": true
          },
          "content": {
            "$ref": "#/components/schemas/AEC.Backend.Application.DTO.AIChat.ChatMessageDTO"
          }
        },
        "additionalProperties": false,
        "description": "A single event (message) within an AI chat session."
      },
      "AEC.Backend.Application.DTO.AIChat.SessionResponseDTO": {
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string",
            "description": "Identifier of the newly created session.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Response payload returned after creating an AI chat session."
      },
      "AEC.Backend.Application.DTO.Agent.ConsentWithDetailsDTO": {
        "type": "object",
        "properties": {
          "consentId": {
            "type": "integer",
            "description": "Unique identifier of the consent record.",
            "format": "int32"
          },
          "tokenId": {
            "type": "integer",
            "description": "Identifier of the token associated with the consent.",
            "format": "int32"
          },
          "oktaUser": {
            "type": "string",
            "description": "Okta user (email/identifier) the consent belongs to.",
            "nullable": true
          },
          "applicationName": {
            "type": "string",
            "description": "Name of the application the consent applies to.",
            "nullable": true
          },
          "consentGiven": {
            "type": "boolean",
            "description": "True when consent has been granted."
          }
        },
        "additionalProperties": false,
        "description": "Response payload describing a consent record together with related token, user, and\napplication details."
      },
      "AEC.Backend.Application.DTO.Agent.GrantConsentDTO": {
        "type": "object",
        "properties": {
          "applicationId": {
            "type": "integer",
            "description": "Identifier of the application to grant consent for. Required.",
            "format": "int32"
          },
          "tokenSecret": {
            "type": "string",
            "description": "Access token secret to store for the application. Required.",
            "nullable": true
          },
          "refreshTokenSecret": {
            "type": "string",
            "description": "Refresh token secret to store for the application. Required.",
            "nullable": true
          },
          "expiresInDays": {
            "type": "integer",
            "description": "Optional number of days until the token expires; null to leave unset.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Request payload for granting the current user's consent to an application, providing the\ntoken secrets to store for it."
      },
      "AEC.Backend.Application.DTO.Agent.UpdateConsentStatusDTO": {
        "type": "object",
        "properties": {
          "consentGiven": {
            "type": "boolean",
            "description": "True to grant consent, false to revoke it. Required."
          }
        },
        "additionalProperties": false,
        "description": "Request payload for updating whether consent is granted for an application."
      },
      "AEC.Backend.Application.DTO.CreateApplicationDTO": {
        "type": "object",
        "properties": {
          "hostApplicationId": {
            "type": "integer",
            "description": "Identifier of the host application this integration is based on. Required.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Display name for the application integration. Required.",
            "nullable": true
          },
          "baseUrl": {
            "type": "string",
            "description": "Base URL of the external application's API. Required for interactive OAuth setup.",
            "nullable": true
          },
          "clientId": {
            "type": "string",
            "description": "OAuth client identifier. Required for interactive OAuth setup.",
            "nullable": true
          },
          "clientSecret": {
            "type": "string",
            "description": "OAuth client secret. Required for interactive OAuth setup and stored securely.",
            "nullable": true
          },
          "redirectUrl": {
            "type": "string",
            "description": "OAuth redirect URL. Required for interactive OAuth setup.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Request payload for registering a new tenant application integration, including the\nOAuth client credentials used to connect to the external host application."
      },
      "AEC.Backend.Application.DTO.ErrorMessageDTO": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Human-readable description of the error.",
            "nullable": true
          },
          "hint": {
            "type": "string",
            "description": "Optional hint suggesting how to resolve the error.",
            "nullable": true
          },
          "claimTypes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Claim types relevant to the error, e.g. claims that were missing or required.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Response payload describing an error, returned when a request fails validation or\nauthorization checks."
      },
      "AEC.Backend.Application.DTO.IntegrationDTO": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Unique identifier of the integration.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Display name of the integration.",
            "nullable": true
          },
          "consentGiven": {
            "type": "boolean",
            "description": "True when the current user has granted consent for this integration."
          }
        },
        "additionalProperties": false,
        "description": "Response payload representing an application integration and whether the current user\nhas granted consent to it."
      },
      "AEC.Backend.Application.DTO.Okta.OktaUserDTO": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Okta identifier of the user.",
            "nullable": true
          },
          "firstName": {
            "type": "string",
            "description": "User's first (given) name.",
            "nullable": true
          },
          "lastName": {
            "type": "string",
            "description": "User's last (family) name.",
            "nullable": true
          },
          "email": {
            "type": "string",
            "description": "User's email address.",
            "nullable": true
          },
          "mobilePhone": {
            "type": "string",
            "description": "User's mobile phone number.",
            "nullable": true
          },
          "status": {
            "type": "string",
            "description": "Okta account status, e.g. `ACTIVE` or `PROVISIONED`.",
            "nullable": true
          },
          "created": {
            "type": "string",
            "description": "Timestamp when the Okta user was created, if available.",
            "format": "date-time",
            "nullable": true
          },
          "lastLogin": {
            "type": "string",
            "description": "Timestamp of the user's most recent login, if available.",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Response payload representing a user profile retrieved from Okta."
      },
      "AEC.Backend.Application.DTO.Okta.TenantRequest": {
        "type": "object",
        "properties": {
          "tenants": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The tenant names/identifiers included in the request.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Request payload carrying a set of tenant identifiers to operate on."
      },
      "AEC.Backend.Application.DTO.SimpleClaimDTO": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "The claim type (name), e.g. `email` or `sub`.",
            "nullable": true
          },
          "value": {
            "type": "string",
            "description": "The claim value.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Response payload representing a single identity claim as a type/value pair."
      },
      "AEC.Backend.Application.DTO.TokenExpiredDTO": {
        "type": "object",
        "properties": {
          "tokenId": {
            "type": "integer",
            "description": "Identifier of the token that was checked.",
            "format": "int32"
          },
          "isExpired": {
            "type": "boolean",
            "description": "True when the token is expired."
          }
        },
        "additionalProperties": false,
        "description": "Response payload indicating whether a stored token has expired."
      },
      "AEC.Backend.Application.DTO.TokenResponseDTO": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "The token string returned to the caller.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Response payload carrying an issued token value."
      },
      "AEC.Backend.Application.DTO.UpdateApplicationDTO": {
        "type": "object",
        "properties": {
          "hostApplicationId": {
            "type": "integer",
            "description": "New host application identifier, or null to leave unchanged.",
            "format": "int32",
            "nullable": true
          },
          "name": {
            "type": "string",
            "description": "New display name, or null to leave unchanged.",
            "nullable": true
          },
          "baseUrl": {
            "type": "string",
            "description": "New base URL of the external application's API, or null to leave unchanged.",
            "nullable": true
          },
          "clientId": {
            "type": "string",
            "description": "New OAuth client identifier, or null to leave unchanged.",
            "nullable": true
          },
          "clientSecret": {
            "type": "string",
            "description": "New OAuth client secret, or null to leave unchanged.",
            "nullable": true
          },
          "redirectUrl": {
            "type": "string",
            "description": "New OAuth redirect (callback) URL, or null to leave unchanged.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Request payload for partially updating an existing application integration. Only the\nnon-null fields provided by the caller are updated."
      },
      "AEC.Backend.Application.DTO.UpdateTokenDTO": {
        "type": "object",
        "properties": {
          "tokenSecret": {
            "type": "string",
            "description": "The new access token (secret) value. Required.",
            "nullable": true
          },
          "refreshTokenSecret": {
            "type": "string",
            "description": "The new refresh token (secret) value. Required.",
            "nullable": true
          },
          "expiresInDays": {
            "type": "integer",
            "description": "Optional number of days until the token expires; null to leave unset.",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Request payload for updating the stored access/refresh token secrets of an integration."
      },
      "AEC.Backend.Application.DTO.UserClaimsDTO": {
        "type": "object",
        "properties": {
          "claims": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AEC.Backend.Application.DTO.SimpleClaimDTO"
            },
            "description": "The set of identity claims associated with the current user.",
            "nullable": true
          },
          "currentUserEmail": {
            "type": "string",
            "description": "Email of the current authenticated user, if available.",
            "nullable": true
          },
          "extractedEmail": {
            "type": "string",
            "description": "Email extracted from the claims, if available.",
            "nullable": true
          },
          "authenticationType": {
            "type": "string",
            "description": "The authentication scheme/type used, e.g. cookie or bearer.",
            "nullable": true
          },
          "isAuthenticated": {
            "type": "boolean",
            "description": "True when the current request is authenticated.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Response payload describing the current user's identity claims and authentication state."
      },
      "AEC.Backend.Application.DTO.Workstations.CreateWorkstationRequestDTO": {
        "required": [
          "configId",
          "workstationNameSuffix"
        ],
        "type": "object",
        "properties": {
          "configId": {
            "maxLength": 255,
            "minLength": 1,
            "type": "string",
            "description": "Short ID of the chosen workstation configuration."
          },
          "workstationNameSuffix": {
            "maxLength": 100,
            "minLength": 1,
            "type": "string",
            "description": "User-supplied suffix for the workstation name. Combined with the hardcoded,\nserver-derived name prefix to form the full workstation name."
          }
        },
        "additionalProperties": false,
        "description": "Payload to create a new workstation request."
      },
      "AEC.Backend.Application.DTO.Workstations.DeclineWorkstationRequestDTO": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Optional human-readable reason for the decline.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Optional payload when declining a workstation request."
      },
      "AEC.Backend.Application.DTO.Workstations.WorkstationConfigDTO": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Short config ID (last path segment of the resource name).",
            "nullable": true
          },
          "name": {
            "type": "string",
            "description": "Full resource name.",
            "nullable": true
          },
          "displayName": {
            "type": "string",
            "description": "Human-friendly display name of the configuration.",
            "nullable": true
          },
          "machineType": {
            "type": "string",
            "description": "GCE machine type backing workstations of this config, e.g. `e2-standard-4`.",
            "nullable": true
          },
          "image": {
            "type": "string",
            "description": "Container image (base environment / IDE) workstations of this config run.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "A single workstation configuration within the tenant's cluster."
      },
      "AEC.Backend.Application.DTO.Workstations.WorkstationDTO": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Short workstation ID (last path segment of the resource name).",
            "nullable": true
          },
          "configId": {
            "type": "string",
            "description": "ID of the workstation config this workstation belongs to.",
            "nullable": true
          },
          "name": {
            "type": "string",
            "description": "Full resource name.",
            "nullable": true
          },
          "displayName": {
            "type": "string",
            "description": "Human-friendly display name of the workstation.",
            "nullable": true
          },
          "state": {
            "type": "string",
            "description": "Workstation state, e.g. `STATE_RUNNING`, `STATE_STOPPED`, `STATE_STARTING`.",
            "nullable": true
          },
          "host": {
            "type": "string",
            "description": "Ingress host, e.g. `w-user-xxxx.cluster-yyyy.cloudworkstations.dev`.",
            "nullable": true
          },
          "uid": {
            "type": "string",
            "description": "Server-assigned unique identifier (UID) of the workstation.",
            "nullable": true
          },
          "startTime": {
            "type": "string",
            "description": "Time the workstation was most recently started (RFC 3339), empty if never started.",
            "nullable": true
          },
          "port": {
            "type": "integer",
            "description": "Ingress port prefixed onto the host to form the launch URL.",
            "format": "int32"
          },
          "isRunning": {
            "type": "boolean",
            "description": "True when the workstation is running and reachable at its host.",
            "readOnly": true
          },
          "launchUrl": {
            "type": "string",
            "description": "Direct URL the user opens to access the workstation (only reachable while running).",
            "nullable": true,
            "readOnly": true
          }
        },
        "additionalProperties": false,
        "description": "A single Cloud Workstation as surfaced to the frontend."
      },
      "AEC.Backend.Application.DTO.Workstations.WorkstationRequestDTO": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Unique identifier of the workstation request.",
            "format": "int32"
          },
          "configId": {
            "type": "string",
            "description": "Identifier of the workstation configuration requested.",
            "nullable": true
          },
          "configDisplayName": {
            "type": "string",
            "description": "Display name of the requested configuration, if available.",
            "nullable": true
          },
          "workstationName": {
            "type": "string",
            "description": "Full name of the workstation to be created.",
            "nullable": true
          },
          "requestedBy": {
            "type": "string",
            "description": "Identifier of the user who submitted the request.",
            "nullable": true
          },
          "requestedByName": {
            "type": "string",
            "description": "Display name of the requesting user, if available.",
            "nullable": true
          },
          "status": {
            "$ref": "#/components/schemas/AEC.Backend.Application.Entities.WorkstationRequestStatus"
          },
          "createdAt": {
            "type": "string",
            "description": "Timestamp when the request was created.",
            "format": "date-time"
          },
          "reviewedBy": {
            "type": "string",
            "description": "Identifier of the reviewer who processed the request, if reviewed.",
            "nullable": true
          },
          "reviewedAt": {
            "type": "string",
            "description": "Timestamp when the request was reviewed, if reviewed.",
            "format": "date-time",
            "nullable": true
          },
          "declineReason": {
            "type": "string",
            "description": "Reason provided when the request was declined, if applicable.",
            "nullable": true
          },
          "createdWorkstationName": {
            "type": "string",
            "description": "Name of the workstation created for this request, once provisioned.",
            "nullable": true
          },
          "provisioningError": {
            "type": "string",
            "description": "Error recorded when provisioning failed, if applicable.",
            "nullable": true
          },
          "provisionedAt": {
            "type": "string",
            "description": "Timestamp when provisioning completed, if applicable.",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Read model for a workstation request returned by the APIs."
      },
      "AEC.Backend.Application.DTO.Workstations.WorkstationRequestOptionsDTO": {
        "type": "object",
        "properties": {
          "namePrefix": {
            "type": "string",
            "description": "Hardcoded first part of the workstation name, derived from the current user's name\nclaim (e.g. `aleznauer-albert-mircea`). The user appends their own suffix.",
            "nullable": true
          },
          "configs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationConfigDTO"
            },
            "description": "Configurations available in the current tenant's cluster.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Data the frontend needs to render the \"request a workstation\" form: the hardcoded\nname prefix derived from the current user (from claims) and the list of workstation\nconfigurations the user can choose from."
      },
      "AEC.Backend.Application.DTO.Workstations.WorkstationStartResponseDTO": {
        "type": "object",
        "properties": {
          "workstationId": {
            "type": "string",
            "description": "Identifier of the workstation that was started.",
            "nullable": true
          },
          "operationName": {
            "type": "string",
            "description": "Name of the long-running operation returned by the start call.",
            "nullable": true
          },
          "started": {
            "type": "boolean",
            "description": "True when the start request was accepted. The workstation transitions to\n`STATE_RUNNING` asynchronously; poll the workstation state before launching."
          }
        },
        "additionalProperties": false,
        "description": "Result of a workstation start request."
      },
      "AEC.Backend.Application.DTO.Workstations.WorkstationsOverviewDTO": {
        "type": "object",
        "properties": {
          "tenant": {
            "type": "string",
            "description": "The tenant whose cluster these workstations belong to.",
            "nullable": true
          },
          "clusterId": {
            "type": "string",
            "description": "Derived cluster ID, e.g. `cluster-{tenant}`.",
            "nullable": true
          },
          "configs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationConfigDTO"
            },
            "description": "Configurations available in the cluster.",
            "nullable": true
          },
          "workstations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AEC.Backend.Application.DTO.Workstations.WorkstationDTO"
            },
            "description": "All workstations across the configurations, each tagged with its `ConfigId`.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "All workstations available to the current tenant, grouped with the configurations\nthey belong to so the user can select which configuration to work with."
      },
      "AEC.Backend.Application.Entities.Application": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "maxLength": 255,
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false,
        "description": "Host-level catalog entry for an integration type.\nTenant-specific OAuth config is stored in TenantApplication."
      },
      "AEC.Backend.Application.Entities.ExplicitConsent": {
        "required": [
          "oktaUser"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "applicationsId": {
            "type": "integer",
            "format": "int32"
          },
          "thirdPartyTokenId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "oktaUser": {
            "maxLength": 255,
            "minLength": 1,
            "type": "string"
          },
          "consentGiven": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "AEC.Backend.Application.Entities.TenantApplication": {
        "required": [
          "hostApplicationId",
          "name"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "hostApplicationId": {
            "type": "integer",
            "description": "External reference to the host Application.Id.",
            "format": "int32"
          },
          "name": {
            "maxLength": 255,
            "minLength": 1,
            "type": "string",
            "description": "Denormalized name (matches host Application.Name)."
          },
          "baseUrl": {
            "type": "string",
            "nullable": true
          },
          "clientId": {
            "maxLength": 255,
            "type": "string",
            "nullable": true
          },
          "clientSecret": {
            "type": "string",
            "description": "Stored as a Google Secret Manager secret name, not the actual secret value.",
            "nullable": true
          },
          "redirectUrl": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Tenant-specific OAuth configuration for an application.\nHostApplicationId references Application.Id in the host database.\nPer-tenant: each tenant configures their own ClientId, ClientSecret, etc."
      },
      "AEC.Backend.Application.Entities.ThirdPartyToken": {
        "required": [
          "refreshTokenSecret",
          "tokenSecret"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "expireDateRefreshToken": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "tokenSecret": {
            "minLength": 1,
            "type": "string"
          },
          "refreshTokenSecret": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "AEC.Backend.Application.Entities.WorkstationRequestStatus": {
        "enum": [
          0,
          1,
          2,
          3,
          4,
          5
        ],
        "type": "integer",
        "description": "Lifecycle state of a workstation request within a tenant.",
        "format": "int32"
      },
      "Microsoft.AspNetCore.Mvc.ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": { }
      }
    }
  },
  "tags": [
    {
      "name": "Auth",
      "description": "Handles interactive user authentication against Okta (OpenID Connect), including\ninitiating the sign-in challenge and signing the user out.\nSensitive configuration (Okta domain, client IDs, API tokens) is resolved from\nGoogle Secret Manager via the SecretManagerHelper."
    },
    {
      "name": "Chat",
      "description": "Provides the AI chat experience backed by the Google agent service. Handles\nsending messages, and creating, listing, selecting and retrieving chat sessions\nfor the current user. Consent-sensitive responses are post-processed before\nbeing returned to the caller."
    },
    {
      "name": "DeploymentRegion",
      "description": "Identifies the regional Application deployment without exposing database configuration."
    },
    {
      "name": "HostApplications",
      "description": "Manages host-level applications (OAuth integrations catalog).\nThese are shared across all tenants - each tenant then provides their own OAuth credentials."
    },
    {
      "name": "OAuth",
      "description": "Handles the OAuth 2.0 authorization-code flow for third-party providers\n(Gitea, GitHub, Jira and Confluence). Exposes \"initiate\" endpoints that redirect the\nuser to the provider's consent screen and \"callback\" endpoints that exchange the returned\ncode for tokens, persisting only Secret Manager references in the tenant database."
    },
    {
      "name": "OktaAPIs",
      "description": "Handles user authentication, authorization and user/group management by integrating with\nOkta as an Identity Provider. Sensitive configuration (Okta domain, client IDs, API tokens)\nis retrieved from Google Secret Manager. Group operations are scoped to the current tenant."
    },
    {
      "name": "TokenExchange",
      "description": "Performs a silent token exchange to switch the authenticated user into a specific\ntenant context. Validates that the caller is authenticated and authorized for the\nrequested tenant, then issues a prompt-less OpenID Connect challenge that mints a\ntenant-scoped token."
    },
    {
      "name": "Tokens",
      "description": "Manages tenant OAuth applications, user consents and third-party tokens.\nAlso exposes helper endpoints for inspecting the current authenticated identity\nand the raw access/id tokens. Actual secret values are stored in Secret Manager;\nonly secret names are persisted in the database."
    },
    {
      "name": "WhoAmI",
      "description": "Exposes information about the currently authenticated user and the resolved\nmulti-tenant context. Used by the frontend to validate the session and to\npopulate profile and tenant details."
    },
    {
      "name": "WorkstationRequests",
      "description": "Workstation request workflow for the current tenant. Any authenticated user can view\nthe request options and submit a request; listing pending requests and approving or\ndeclining them is restricted to tenant (Okta) admins. Requests are stored in the\nper-tenant database, so cross-tenant requests are never visible or actionable."
    },
    {
      "name": "Workstations",
      "description": "Lists and starts Google Cloud Workstations for the signed-in user. Management calls\n(list/start) run server-side with the backend service account; the user opens the\nrunning workstation directly at its host URL."
    }
  ]
}