{
  "openapi": "3.1.1",
  "info": {
    "title": "Julia API",
    "description": "API for Cyberzone.Julia, providing authentication and authorization services",
    "contact": {
      "name": "Anton Babenko",
      "url": "https://t.me/saph1s",
      "email": "saph1s@cyberzone.dev"
    },
    "version": "0.8.0+ac4804d21cea752ed6563408ed011f63a57f40f3"
  },
  "servers": [
    {
      "url": "http://localhost:5100/"
    }
  ],
  "paths": {
    "/v1/admin/client-applications": {
      "get": {
        "tags": [
          "Admin"
        ],
        "summary": "Get Client Applications",
        "description": "Returns a list of all client applications configured in the system.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ClientApplicationResponse"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      },
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Create Client Application",
        "description": "Creates a new client application.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClientApplicationCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientApplicationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequest"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/auth/redirect": {
      "get": {
        "tags": [
          "Authentication and Authorization"
        ],
        "summary": "Redirect to Authentication Service",
        "description": "Redirects the user to the specified authentication service for login.\nThe sourceId is used to retrieve the callback URL for the authentication initiator.",
        "parameters": [
          {
            "name": "sourceId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "service",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "authentik"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Found"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequest"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/v1/auth/callback": {
      "get": {
        "tags": [
          "Authentication and Authorization"
        ],
        "summary": "Handle Authentication Callback",
        "description": "Handles the callback from the authentication service after the user has logged in.\nIt retrieves the user information and generates a trade code for further processing.",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Found"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequest"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/v1/auth/exchange": {
      "post": {
        "tags": [
          "Authentication and Authorization"
        ],
        "summary": "Exchange Trade Code for JWT Tokens",
        "description": "Exchanges a temporary trade code for JWT access and refresh tokens.\nThe trade code is obtained from the authentication callback and must be used within 5 minutes.\nReturns JWT tokens and sets an HTTP-only access token cookie.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExchangeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequest"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFound"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/v1/auth/refresh": {
      "post": {
        "tags": [
          "Authentication and Authorization"
        ],
        "summary": "Refresh Authentication Token",
        "description": "Refreshes the authentication token using the provided refresh token in the request body.\nRequires a valid refresh token in the request body.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefreshTokenRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequest"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/v1/auth/publickey": {
      "get": {
        "tags": [
          "Authentication and Authorization"
        ],
        "summary": "Get Public Key",
        "description": "Returns the public key used for JWT token verification.\nYou can specify the type of key to return: 'base64' or 'pem'.",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "base64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequest"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable"
          }
        },
        "security": []
      }
    },
    "/v1/auth/expired": {
      "get": {
        "tags": [
          "Authentication and Authorization"
        ],
        "summary": "Get Expired Tokens List",
        "description": "Returns a list of expired tokens (blacklisted JTI values)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/auth/logout": {
      "post": {
        "tags": [
          "Authentication and Authorization"
        ],
        "summary": "Logout User",
        "description": "Logs out the user by revoking their session and deleting the access cookie.\nRequires a valid JWT token in the Authorization header.",
        "responses": {
          "204": {
            "description": "No Content"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequest"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          }
        ]
      }
    },
    "/v1/webhooks/debug": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Debug Endpoint",
        "description": "Endpoint to debug incoming webhook data",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {}
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/webhooks/authentik": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Authentik Webhook",
        "description": "Endpoint to receive webhooks from Authentik",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthentikWebhook"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "No Content"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/users/@me": {
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "Get current user profile",
        "description": "Get the profile of the currently authenticated user.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserGetResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFound"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerError"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          }
        ]
      }
    },
    "/v1/users/@me/preferences": {
      "patch": {
        "tags": [
          "Users"
        ],
        "summary": "Update current user preferences",
        "description": "Update the preferences of the currently authenticated user.",
        "responses": {
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerError"
                }
              }
            }
          },
          "501": {
            "description": "Not Implemented"
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          }
        ]
      }
    },
    "/v1/users": {
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "Get user profile by username",
        "description": "Get the profile of a user by their username. If the username matches the currently authenticated user, it will return their own profile. Otherwise, it requires admin permissions to view another user's profile.",
        "parameters": [
          {
            "name": "username",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserGetResponsePublic"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFound"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerError"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/users/{uuid}": {
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "Get user profile by UUID",
        "description": "Get the profile of a user by their UUID. If the UUID matches the currently authenticated user, it will return their own profile. Otherwise, it requires admin permissions to view another user's profile.",
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserGetResponsePublic"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFound"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerError"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      },
      "patch": {
        "tags": [
          "Users"
        ],
        "summary": "Update user profile by UUID",
        "description": "Update the profile of a user by their UUID. If the UUID matches the currently authenticated user, it will update their own profile. Otherwise, it requires admin permissions to update another user's profile.",
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserPatchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerError"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/users/{uuid}/permissions": {
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "Get user permissions by UUID",
        "description": "Get the permissions of a user by their UUID. Users can view their own permissions, or admins can view any user's permissions.",
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequest"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerError"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/users/{uuid}/avatar": {
      "patch": {
        "tags": [
          "Users"
        ],
        "summary": "Update user avatar by UUID",
        "description": "Update the avatar of a user by their UUID. If the UUID matches the currently authenticated user, it will update their own avatar. Otherwise, it requires admin permissions to update another user's avatar.",
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "required": [
                  "avatar"
                ],
                "type": "object",
                "properties": {
                  "avatar": {
                    "$ref": "#/components/schemas/IFormFile"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerError"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/users/{uuid}/banner": {
      "patch": {
        "tags": [
          "Users"
        ],
        "summary": "Update user banner by UUID",
        "description": "Update the banner of a user by their UUID. If the UUID matches the currently authenticated user, it will update their own banner. Otherwise, it requires admin permissions to update another user's banner.",
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "required": [
                  "banner"
                ],
                "type": "object",
                "properties": {
                  "banner": {
                    "$ref": "#/components/schemas/IFormFile"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerError"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/users/{uuid}/sessions": {
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "Get user sessions by UUID",
        "description": "Get the sessions of a user by their UUID. If the UUID matches the currently authenticated user, it will return their own sessions. Otherwise, it requires admin permissions to view another user's sessions.",
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "onlyActive",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UserSessionResponse"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFound"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerError"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/users/{uuid}/sessions/{sessionId}": {
      "delete": {
        "tags": [
          "Users"
        ],
        "summary": "Delete user sessions by UUID",
        "description": "Delete the sessions of a user by their UUID. If the UUID matches the currently authenticated user, it will allow them to delete their own sessions. Otherwise, it requires admin permissions to delete another user's sessions.",
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFound"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerError"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/departments": {
      "get": {
        "tags": [
          "Departments"
        ],
        "summary": "Get Departments",
        "description": "Retrieves a list of departments. Use ?tree=true for hierarchical view.",
        "parameters": [
          {
            "name": "tree",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DepartmentResponse"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      },
      "post": {
        "tags": [
          "Departments"
        ],
        "summary": "Create Department",
        "description": "Creates a new department with system roles",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepartmentCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepartmentResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/departments/{departmentId}": {
      "get": {
        "tags": [
          "Departments"
        ],
        "summary": "Get Department",
        "description": "Retrieves a specific department by ID",
        "parameters": [
          {
            "name": "departmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "includeMembers",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "includeRoles",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepartmentResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      },
      "patch": {
        "tags": [
          "Departments"
        ],
        "summary": "Update Department",
        "description": "Updates a department's properties",
        "parameters": [
          {
            "name": "departmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepartmentUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepartmentResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Departments"
        ],
        "summary": "Delete Department",
        "description": "Deletes a department (must have no children)",
        "parameters": [
          {
            "name": "departmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/departments/{departmentId}/avatar": {
      "patch": {
        "tags": [
          "Departments"
        ],
        "summary": "Update Department Avatar",
        "parameters": [
          {
            "name": "departmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "required": [
                  "file"
                ],
                "type": "object",
                "properties": {
                  "file": {
                    "$ref": "#/components/schemas/IFormFile"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepartmentResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/departments/{departmentId}/banner": {
      "patch": {
        "tags": [
          "Departments"
        ],
        "summary": "Update Department Banner",
        "parameters": [
          {
            "name": "departmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "required": [
                  "file"
                ],
                "type": "object",
                "properties": {
                  "file": {
                    "$ref": "#/components/schemas/IFormFile"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepartmentResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/departments/{departmentId}/permissions": {
      "get": {
        "tags": [
          "Departments"
        ],
        "summary": "Get Department Permissions",
        "parameters": [
          {
            "name": "departmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      },
      "put": {
        "tags": [
          "Departments"
        ],
        "summary": "Set Department Permissions",
        "parameters": [
          {
            "name": "departmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepartmentPermissionsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepartmentResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/departments/{departmentId}/members": {
      "get": {
        "tags": [
          "Department Members"
        ],
        "summary": "Get Department Members",
        "parameters": [
          {
            "name": "departmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DepartmentMemberResponse"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      },
      "post": {
        "tags": [
          "Department Members"
        ],
        "summary": "Add Department Member",
        "parameters": [
          {
            "name": "departmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepartmentMemberAddRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepartmentMemberResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/departments/{departmentId}/members/{userId}": {
      "patch": {
        "tags": [
          "Department Members"
        ],
        "summary": "Update Member Role",
        "parameters": [
          {
            "name": "departmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepartmentMemberUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepartmentMemberResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Department Members"
        ],
        "summary": "Remove Department Member",
        "parameters": [
          {
            "name": "departmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/departments/{departmentId}/roles": {
      "get": {
        "tags": [
          "Department Roles"
        ],
        "summary": "Get Department Roles",
        "parameters": [
          {
            "name": "departmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DepartmentRoleResponse"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      },
      "post": {
        "tags": [
          "Department Roles"
        ],
        "summary": "Create Custom Role",
        "parameters": [
          {
            "name": "departmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepartmentRoleCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepartmentRoleResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/departments/{departmentId}/roles/{roleId}": {
      "patch": {
        "tags": [
          "Department Roles"
        ],
        "summary": "Update Role",
        "parameters": [
          {
            "name": "departmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "roleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepartmentRoleUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepartmentRoleResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Department Roles"
        ],
        "summary": "Delete Role",
        "description": "Deletes a custom role (system roles cannot be deleted)",
        "parameters": [
          {
            "name": "departmentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "roleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/v1/users/{userId}/departments": {
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "Get User Departments",
        "description": "Retrieves all departments and roles for a specific user",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UserDepartmentResponse"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Forbidden"
                }
              }
            }
          }
        },
        "security": [
          {
            "Bearer": []
          },
          {
            "Cookie": []
          },
          {
            "Api Token": []
          }
        ]
      }
    },
    "/": {
      "get": {
        "tags": [
          "Cyberzone.Julia"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": [
          "Cyberzone.Julia"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": []
      }
    }
  },
  "components": {
    "schemas": {
      "AuthentikEventType": {
        "enum": [
          "UserCreated",
          "UserUpdated",
          "UserDeleted",
          "GroupCreated",
          "GroupUpdated",
          "GroupDeleted"
        ]
      },
      "AuthentikWebhook": {
        "required": [
          "event_type",
          "data"
        ],
        "type": "object",
        "properties": {
          "event_type": {
            "$ref": "#/components/schemas/AuthentikEventType"
          },
          "initiator_username": {
            "type": [
              "null",
              "string"
            ]
          },
          "data": {
            "$ref": "#/components/schemas/JsonElement"
          }
        }
      },
      "BadRequest": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "ClientApplicationCreateRequest": {
        "required": [
          "name",
          "clientApplicationCallbackUrl"
        ],
        "type": "object",
        "properties": {
          "name": {
            "maxLength": 128,
            "type": "string"
          },
          "clientApplicationCallbackUrl": {
            "type": "string",
            "format": "uri"
          },
          "isActive": {
            "type": "boolean"
          }
        }
      },
      "ClientApplicationResponse": {
        "required": [
          "id",
          "name",
          "clientApplicationCallbackUrl",
          "isActive"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "clientApplicationCallbackUrl": {
            "type": "string",
            "format": "uri"
          },
          "isActive": {
            "type": "boolean"
          }
        }
      },
      "DepartmentCreateRequest": {
        "required": [
          "slug",
          "name"
        ],
        "type": "object",
        "properties": {
          "slug": {
            "maxLength": 128,
            "type": "string"
          },
          "name": {
            "maxLength": 256,
            "type": "string"
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "parent_id": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "permissions": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string"
            }
          },
          "inherit_permissions": {
            "type": "boolean"
          },
          "sort_order": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "DepartmentMemberAddRequest": {
        "required": [
          "user_id",
          "role_slug"
        ],
        "type": "object",
        "properties": {
          "user_id": {
            "type": "string",
            "format": "uuid"
          },
          "role_slug": {
            "maxLength": 128,
            "type": "string"
          }
        }
      },
      "DepartmentMemberResponse": {
        "required": [
          "id",
          "department_id",
          "user_id",
          "role"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "department_id": {
            "type": "string",
            "format": "uuid"
          },
          "user_id": {
            "type": "string",
            "format": "uuid"
          },
          "role": {
            "$ref": "#/components/schemas/DepartmentRoleResponse"
          },
          "joined_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DepartmentMemberUpdateRequest": {
        "required": [
          "role_slug"
        ],
        "type": "object",
        "properties": {
          "role_slug": {
            "maxLength": 128,
            "type": "string"
          }
        }
      },
      "DepartmentPermissionsRequest": {
        "required": [
          "permissions"
        ],
        "type": "object",
        "properties": {
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "DepartmentResponse": {
        "required": [
          "id",
          "slug",
          "name"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "avatar_url": {
            "type": [
              "null",
              "string"
            ]
          },
          "banner_url": {
            "type": [
              "null",
              "string"
            ]
          },
          "parent_id": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "inherit_permissions": {
            "type": "boolean"
          },
          "sort_order": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "is_active": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "children": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/DepartmentResponse"
            }
          },
          "members": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/DepartmentMemberResponse"
            }
          },
          "roles": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/DepartmentRoleResponse"
            }
          }
        }
      },
      "DepartmentRoleCreateRequest": {
        "required": [
          "name",
          "slug"
        ],
        "type": "object",
        "properties": {
          "name": {
            "maxLength": 128,
            "type": "string"
          },
          "slug": {
            "maxLength": 128,
            "type": "string"
          },
          "weight": {
            "maximum": 999,
            "minimum": 3,
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "permissions": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string"
            }
          }
        }
      },
      "DepartmentRoleResponse": {
        "required": [
          "id",
          "department_id",
          "name",
          "slug"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "department_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "is_system": {
            "type": "boolean"
          },
          "weight": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          }
        }
      },
      "DepartmentRoleUpdateRequest": {
        "type": "object",
        "properties": {
          "name": {
            "maxLength": 128,
            "type": [
              "null",
              "string"
            ]
          },
          "slug": {
            "maxLength": 128,
            "type": [
              "null",
              "string"
            ]
          },
          "weight": {
            "maximum": 999,
            "minimum": 3,
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "permissions": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string"
            }
          }
        }
      },
      "DepartmentUpdateRequest": {
        "type": "object",
        "properties": {
          "slug": {
            "maxLength": 128,
            "type": [
              "null",
              "string"
            ]
          },
          "name": {
            "maxLength": 256,
            "type": [
              "null",
              "string"
            ]
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "parent_id": {
            "type": [
              "null",
              "string"
            ],
            "format": "uuid"
          },
          "inherit_permissions": {
            "type": [
              "null",
              "boolean"
            ]
          },
          "sort_order": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "is_active": {
            "type": [
              "null",
              "boolean"
            ]
          }
        }
      },
      "ExchangeRequest": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          }
        }
      },
      "Forbidden": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "IFormFile": {
        "type": "string",
        "format": "binary"
      },
      "InternalServerError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "JsonElement": {},
      "LoginResponse": {
        "required": [
          "access_token",
          "refresh_token"
        ],
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string"
          },
          "refresh_token": {
            "type": "string"
          },
          "expires_in": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "NotFound": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "Ok": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "message": {}
        }
      },
      "RefreshTokenRequest": {
        "type": "object",
        "properties": {
          "refresh_token": {
            "type": "string"
          }
        }
      },
      "Unauthorized": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "UserDepartmentResponse": {
        "required": [
          "department",
          "role"
        ],
        "type": "object",
        "properties": {
          "department": {
            "$ref": "#/components/schemas/DepartmentResponse"
          },
          "role": {
            "$ref": "#/components/schemas/DepartmentRoleResponse"
          },
          "joined_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "UserGetResponse": {
        "required": [
          "id",
          "email",
          "username",
          "firstname",
          "lastname",
          "permissions",
          "groups",
          "departments"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string"
          },
          "username": {
            "type": "string"
          },
          "firstname": {
            "type": "string"
          },
          "lastname": {
            "type": "string"
          },
          "middlename": {
            "type": [
              "null",
              "string"
            ]
          },
          "avatar": {
            "type": [
              "null",
              "string"
            ]
          },
          "banner": {
            "type": [
              "null",
              "string"
            ]
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserGroup"
            }
          },
          "departments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserDepartmentResponse"
            }
          }
        }
      },
      "UserGetResponsePublic": {
        "required": [
          "id",
          "username",
          "groups"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "username": {
            "type": "string"
          },
          "avatar": {
            "type": [
              "null",
              "string"
            ]
          },
          "banner": {
            "type": [
              "null",
              "string"
            ]
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserGroup"
            }
          }
        }
      },
      "UserGroup": {
        "required": [
          "slug"
        ],
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": [
              "null",
              "string"
            ]
          },
          "logo": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "UserPatchRequest": {
        "type": "object",
        "properties": {
          "username": {
            "pattern": "^[a-zA-Z0-9_-]{3,32}$",
            "type": [
              "null",
              "string"
            ]
          },
          "email": {
            "maxLength": 320,
            "minLength": 0,
            "type": [
              "null",
              "string"
            ]
          },
          "firstname": {
            "maxLength": 128,
            "minLength": 1,
            "type": [
              "null",
              "string"
            ]
          },
          "lastname": {
            "maxLength": 128,
            "minLength": 1,
            "type": [
              "null",
              "string"
            ]
          },
          "middlename": {
            "maxLength": 128,
            "minLength": 0,
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "UserSessionResponse": {
        "required": [
          "id",
          "createdAt",
          "expiresAt",
          "ipAddresses",
          "userAgent"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": [
              "null",
              "string"
            ],
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "ipAddresses": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "userAgent": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "http",
        "description": "JWT Authorization header",
        "scheme": "bearer",
        "bearerFormat": "Json Web Token"
      },
      "Cookie": {
        "type": "apiKey",
        "description": "JWT in cookie",
        "name": "cyberzone-auth_access",
        "in": "cookie"
      },
      "Api Token": {
        "type": "apiKey",
        "description": "API token authorization",
        "name": "Api-Token",
        "in": "header"
      }
    }
  },
  "tags": [
    {
      "name": "Admin"
    },
    {
      "name": "Authentication and Authorization"
    },
    {
      "name": "Webhooks"
    },
    {
      "name": "Users"
    },
    {
      "name": "Departments"
    },
    {
      "name": "Department Members"
    },
    {
      "name": "Department Roles"
    },
    {
      "name": "Cyberzone.Julia",
      "x-scalar-ignore": true
    }
  ],
  "externalDocs": {
    "description": "Full documentation",
    "url": "https://confluence.cyberzone.dev/spaces/ASDPUB/overview"
  }
}