{
  "openapi": "3.1.0",
  "info": {
    "description": "Groups API",
    "title": "Groups",
    "version": "1.0"
  },
  "externalDocs": {
    "description": "Trackunit Developer Hub",
    "url": "https://dev.trackunit.com/v3.0/"
  },
  "servers": [
    {
      "url": "https://iris.trackunit.com/api/organization/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "authorizationBearer": []
    }
  ],
  "paths": {
    "/assets/{assetId}/groups": {
      "delete": {
        "description": "Remove Asset from Groups. If the Asset is not in a chosen Group, no change is made to that Group.",
        "operationId": "removeAssetFromGroups",
        "parameters": [
          {
            "description": "ID of the Asset",
            "in": "path",
            "name": "assetId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAssetGroupsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Asset was successfully removed from Groups."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Remove Asset from Groups",
        "tags": ["Group Asset Relations"]
      },
      "post": {
        "description": "Add Asset to Groups. If the Asset is already in a chosen Group, no change is made to that Group.",
        "operationId": "addAssetToGroups",
        "parameters": [
          {
            "description": "ID of the Asset",
            "in": "path",
            "name": "assetId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAssetGroupsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Asset was successfully added to groups."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Add Asset to Groups",
        "tags": ["Group Asset Relations"]
      }
    },
    "/groups": {
      "get": {
        "description": "Sort properties: id, name, description, usersCount, assetsCount",
        "operationId": "getGroups",
        "parameters": [
          {
            "description": "Zero-based page index (0..N)",
            "example": 0,
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0,
              "minimum": 0
            }
          },
          {
            "description": "The size of the page to be returned",
            "example": 20,
            "in": "query",
            "name": "size",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20,
              "minimum": 1
            }
          },
          {
            "description": "Sort order: `property` (ascending by default), `+property` (ascending), `-property` (descending).",
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "allowEmptyValue": true,
            "description": "Name to filter by",
            "in": "query",
            "name": "name",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "allowEmptyValue": true,
            "description": "Description to filter by",
            "in": "query",
            "name": "description",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "allowEmptyValue": true,
            "description": "Retrieve groups that include the specified Asset",
            "in": "query",
            "name": "assetId",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "allowEmptyValue": true,
            "description": "Retrieve groups that include the specified User",
            "in": "query",
            "name": "userId",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedGroup"
                }
              }
            },
            "description": "A list of available groups."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Get Groups"
      },
      "post": {
        "operationId": "createGroup",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateGroupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/Group"
                }
              }
            },
            "description": "Group was successfully created."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Create Group"
      }
    },
    "/groups/{groupId}": {
      "delete": {
        "operationId": "deleteGroup",
        "parameters": [
          {
            "description": "ID of the Group",
            "in": "path",
            "name": "groupId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Group was successfully deleted."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Delete Group"
      },
      "get": {
        "operationId": "getGroup",
        "parameters": [
          {
            "description": "ID of the group",
            "in": "path",
            "name": "groupId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/Group"
                }
              }
            },
            "description": "A specific group by its group ID."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Get Group"
      },
      "patch": {
        "operationId": "patchGroup",
        "parameters": [
          {
            "description": "ID of the Group",
            "in": "path",
            "name": "groupId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchGroupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/Group"
                }
              }
            },
            "description": "Group was successfully updated."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Update Group"
      }
    },
    "/groups/{groupId}/assets": {
      "delete": {
        "operationId": "removeAssetsFromGroup",
        "parameters": [
          {
            "description": "ID of the Group",
            "in": "path",
            "name": "groupId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RemoveAssetsFromGroupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Assets were successfully removed from the Group."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Remove Assets from Group",
        "tags": ["Group Asset Relations"]
      },
      "get": {
        "operationId": "getAssetsInGroup",
        "parameters": [
          {
            "description": "ID of the Group",
            "in": "path",
            "name": "groupId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/Assets"
                }
              }
            },
            "description": "A list of Assets available in the Group."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Get Assets in Group",
        "tags": ["Group Asset Relations"]
      },
      "post": {
        "operationId": "addAssetsToGroup",
        "parameters": [
          {
            "description": "ID of the Group",
            "in": "path",
            "name": "groupId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddAssetsToGroupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Assets were successfully added to the Group."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Add Assets to Group",
        "tags": ["Group Asset Relations"]
      },
      "put": {
        "operationId": "replaceAssetsInGroup",
        "parameters": [
          {
            "description": "ID of the Group",
            "in": "path",
            "name": "groupId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplaceAssetsInGroupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Assets were successfully replaced in the Group."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Replace Assets in Group",
        "tags": ["Group Asset Relations"]
      }
    },
    "/groups/{groupId}/users": {
      "delete": {
        "operationId": "removeUsersFromGroup",
        "parameters": [
          {
            "description": "ID of the Group",
            "in": "path",
            "name": "groupId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RemoveUsersFromGroupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Users were successfully removed from the Group."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Remove Users from Group",
        "tags": ["Group User Relations"]
      },
      "get": {
        "operationId": "getUsersInGroup",
        "parameters": [
          {
            "description": "ID of the Group",
            "in": "path",
            "name": "groupId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/Users"
                }
              }
            },
            "description": "A list of Users added to the Group."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Get Users in Group",
        "tags": ["Group User Relations"]
      },
      "post": {
        "operationId": "addUsersToGroup",
        "parameters": [
          {
            "description": "ID of the Group",
            "in": "path",
            "name": "groupId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddUsersToGroupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Users were successfully added to the Group."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Add Users to Group",
        "tags": ["Group User Relations"]
      },
      "put": {
        "operationId": "replaceUsersInGroup",
        "parameters": [
          {
            "description": "ID of the Group",
            "in": "path",
            "name": "groupId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplaceUsersInGroupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Users were successfully replaced in the Group."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Replace Users in Group",
        "tags": ["Group User Relations"]
      }
    },
    "/users/{userId}/groups": {
      "delete": {
        "description": "Remove User from Groups. If the User is not in a chosen Group, no change is made to that Group.",
        "operationId": "removeUserFromGroups",
        "parameters": [
          {
            "description": "ID of the User",
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateUserGroupsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "User was successfully removed from Groups."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Remove User from Groups",
        "tags": ["Group User Relations"]
      },
      "post": {
        "description": "Add User to Groups. If the User is already in a chosen Group, no change is made to that Group.",
        "operationId": "addUserToGroups",
        "parameters": [
          {
            "description": "ID of the User",
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateUserGroupsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "User was successfully added to groups."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description": "Bad request"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Invalid or missing bearer token in Authorization header"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "User not allowed to make this request"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Resource not found"
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultError"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Add User to Groups",
        "tags": ["Group User Relations"]
      }
    }
  },
  "components": {
    "schemas": {
      "AddAssetsToGroupRequest": {
        "type": "object",
        "properties": {
          "assets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssetReference"
            }
          }
        }
      },
      "AddUsersToGroupRequest": {
        "type": "object",
        "properties": {
          "users": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserReference"
            }
          }
        }
      },
      "AssetReference": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "Assets": {
        "type": "object",
        "properties": {
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssetReference"
            }
          }
        }
      },
      "AssetsMetadata": {
        "type": "object",
        "properties": {
          "href": {
            "type": "string"
          },
          "totalElements": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "ConstraintViolationError": {
        "type": "object",
        "properties": {
          "code": {
            "type": ["string", "null"],
            "description": "Alphanumeric code (snake case) describing use case specific error"
          },
          "message": {
            "type": "string",
            "description": "Detailed description of error"
          },
          "properties": {
            "type": ["object", "null"],
            "additionalProperties": {},
            "description": "Additional properties to be included in the error response"
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "description": "HTTP status code"
          },
          "violations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Violation"
            }
          }
        }
      },
      "CreateGroupRequest": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "description": "The description of the group",
            "maxLength": 500,
            "minLength": 0
          },
          "name": {
            "type": "string",
            "description": "The name of the group",
            "maxLength": 200,
            "minLength": 0,
            "pattern": "^(?!\\s*$).+"
          }
        },
        "required": ["name"]
      },
      "DefaultError": {
        "type": "object",
        "properties": {
          "code": {
            "type": ["string", "null"],
            "description": "Alphanumeric code (snake case) describing use case specific error"
          },
          "message": {
            "type": "string",
            "description": "Detailed description of error"
          },
          "properties": {
            "type": ["object", "null"],
            "additionalProperties": {},
            "description": "Additional properties to be included in the error response"
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "description": "HTTP status code"
          }
        }
      },
      "Group": {
        "type": "object",
        "properties": {
          "assets": {
            "$ref": "#/components/schemas/AssetsMetadata"
          },
          "description": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "users": {
            "$ref": "#/components/schemas/UsersMetadata"
          }
        }
      },
      "PaginatedGroup": {
        "type": "object",
        "properties": {
          "content": {
            "type": "array",
            "description": "The page content as a list.",
            "items": {
              "$ref": "#/components/schemas/Group"
            }
          },
          "number": {
            "type": "integer",
            "format": "int32",
            "description": "The number of the current page."
          },
          "numberOfElements": {
            "type": "integer",
            "format": "int32",
            "description": "The number of elements currently on this page."
          },
          "size": {
            "type": "integer",
            "format": "int32",
            "description": "The size of the page."
          },
          "totalElements": {
            "type": "integer",
            "format": "int64",
            "description": "The total number of elements."
          },
          "totalPages": {
            "type": "integer",
            "format": "int32",
            "description": "The number of total pages."
          }
        }
      },
      "PatchGroupRequest": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "description": "The description of the group",
            "maxLength": 500,
            "minLength": 0
          },
          "name": {
            "type": "string",
            "description": "The name of the group",
            "maxLength": 200,
            "minLength": 0
          }
        },
        "required": ["name"]
      },
      "RemoveAssetsFromGroupRequest": {
        "type": "object",
        "properties": {
          "assets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssetReference"
            }
          }
        }
      },
      "RemoveUsersFromGroupRequest": {
        "type": "object",
        "properties": {
          "users": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserReference"
            }
          }
        }
      },
      "ReplaceAssetsInGroupRequest": {
        "type": "object",
        "properties": {
          "assets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssetReference"
            }
          }
        }
      },
      "ReplaceUsersInGroupRequest": {
        "type": "object",
        "properties": {
          "users": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserReference"
            }
          }
        }
      },
      "UpdateAssetGroupsRequest": {
        "type": "object",
        "properties": {
          "groupIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "required": ["groupIds"]
      },
      "UpdateUserGroupsRequest": {
        "type": "object",
        "properties": {
          "groupIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "required": ["groupIds"]
      },
      "UserReference": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "Users": {
        "type": "object",
        "properties": {
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserReference"
            }
          }
        }
      },
      "UsersMetadata": {
        "type": "object",
        "properties": {
          "href": {
            "type": "string"
          },
          "totalElements": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "Violation": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "authorizationBearer": {
        "bearerFormat": "JWT",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
