{
  "openapi" : "3.0.0",
  "info" : {
    "title" : "Users API",
    "version" : "1.0.0"
  },
  "servers" : [ {
    "url" : "/"
  } ],
  "paths" : {
    "/br-users/users" : {
      "get" : {
        "description" : "Retrieve a list of user items.",
        "operationId" : "getUserCollection",
        "parameters" : [ {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/userSearchCriteria"
              }
            }
          },
          "description" : "Search criteria to retrieve users",
          "in" : "query",
          "name" : "search",
          "required" : false
        }, {
          "description" : "Skip over a number of elements by specifying an offset value for the query",
          "explode" : true,
          "in" : "query",
          "name" : "offset",
          "required" : false,
          "schema" : {
            "default" : 0,
            "maximum" : 2147483647,
            "minimum" : 0,
            "type" : "integer"
          },
          "style" : "form"
        }, {
          "description" : "Limit the number of elements returned in the response",
          "explode" : true,
          "in" : "query",
          "name" : "limit",
          "required" : false,
          "schema" : {
            "default" : 1000,
            "maximum" : 2147483647,
            "minimum" : 1,
            "type" : "integer"
          },
          "style" : "form"
        }, {
          "description" : "Comma separated list of user properties to sort by",
          "explode" : true,
          "in" : "query",
          "name" : "sortBy",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "style" : "form"
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/userDtoCollection"
                }
              }
            },
            "description" : "Returns a user collection"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      },
      "post" : {
        "description" : "Create a new user.",
        "operationId" : "postUser",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/UserCreateDto"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "201" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/UserDto"
                }
              }
            },
            "description" : "Returns a user"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/users/change-current-password" : {
      "post" : {
        "description" : "Changes the password for the currently authenticated user.",
        "operationId" : "changeCurrentPassword",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/ChangeCurrentPasswordDto"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Password changed successfully"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/forgotten/password" : {
      "post" : {
        "description" : "Public self-service request that emails a password-reset link to the user. Always returns 204 regardless of whether the address belongs to an existing user, so the endpoint cannot be used to enumerate accounts.",
        "operationId" : "requestPasswordReset",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/RequestPasswordResetDto"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "204" : {
            "description" : "Request processed (a link is emailed only if the user exists)"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/login-diagnostics" : {
      "post" : {
        "description" : "Public, pre-authentication endpoint called by the login form after Keycloak rejected a login. Keycloak returns the same generic error for every failure, so this endpoint classifies the cause (via a Keycloak admin lookup of the user's existence and enabled flag) and answers with the legacy ReČeK error type the login form maps to a specific message: -5 unknown username, -6 wrong password (existing, enabled user), -7 disabled user. When the cause cannot be determined it returns 204 and the form keeps the generic message. The endpoint does not authenticate the user and never reveals or checks the password.\n\nSECURITY: the endpoint is intentionally unauthenticated (empty permissionsRequired in the ModuleDescriptor) and intentionally allows account enumeration: distinguishing \"no such user\" from \"wrong password\" reveals whether an account exists, and -7 reveals that it is deactivated. This weakens Keycloak's anti-enumeration stance and was consciously accepted by the customer as a restoration of the earlier ReČeK login behaviour.",
        "operationId" : "diagnoseLoginFailure",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/LoginDiagnosticsRequestDto"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "204" : {
            "description" : "Cause of the failed login could not be determined; the generic message should be kept"
          },
          "401" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/LoginDiagnosticsErrorsDto"
                }
              }
            },
            "description" : "Cause of the failed login determined; the body carries exactly one legacy error type (-5 unknown username, -6 wrong password, -7 disabled user)"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "security" : [ ],
        "summary" : "Diagnose why a login failed",
        "tags" : [ "login-diagnostics" ]
      }
    },
    "/br-users/password-reset/validate" : {
      "post" : {
        "description" : "Public endpoint that checks whether a password-reset token from the emailed link is still valid.",
        "operationId" : "validatePasswordResetToken",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/ValidatePasswordResetTokenDto"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "204" : {
            "description" : "Token is valid"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/password-reset/reset" : {
      "post" : {
        "description" : "Public endpoint that sets a new password using a valid password-reset token from the emailed link.",
        "operationId" : "resetPasswordWithToken",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/ResetPasswordWithTokenDto"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "204" : {
            "description" : "Password reset successfully"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/users/{id}" : {
      "delete" : {
        "description" : "Delete user with given ID.",
        "operationId" : "deleteUserById",
        "parameters" : [ {
          "description" : "The UUID of a user",
          "explode" : false,
          "in" : "path",
          "name" : "id",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "responses" : {
          "204" : {
            "description" : "User deleted successfully"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      },
      "get" : {
        "description" : "Retrieve user with given ID",
        "operationId" : "getUserById",
        "parameters" : [ {
          "description" : "The UUID of a user",
          "explode" : false,
          "in" : "path",
          "name" : "id",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/UserDto"
                }
              }
            },
            "description" : "Returns a user"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      },
      "put" : {
        "description" : "Update user with given ID.",
        "operationId" : "putUserById",
        "parameters" : [ {
          "description" : "The UUID of a user",
          "explode" : false,
          "in" : "path",
          "name" : "id",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/UserDto"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "204" : {
            "description" : "User successfully updated"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "409" : {
            "description" : "User was updated or deleted by another transaction"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/users/{id}/reset-password" : {
      "post" : {
        "description" : "Allows an admin to reset another user's password",
        "operationId" : "resetUserPassword",
        "parameters" : [ {
          "explode" : false,
          "in" : "path",
          "name" : "id",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/ResetUserPasswordDto"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "User's password reset successfully"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/roles/keycloak-sync" : {
      "post" : {
        "description" : "Ensures an Eureka role exists for every br role and that it carries exactly the capabilities its permissions resolve to. A role whose capabilities already match is left untouched, so the call is idempotent and cheap to re-run.",
        "operationId" : "keycloakRoleSync",
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/KeycloakRoleSyncResultDto"
                }
              }
            },
            "description" : "Role definitions synced"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "summary" : "Sync the br role definitions into Eureka (mod-roles-keycloak)",
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/users/keycloak-backfill" : {
      "get" : {
        "description" : "State, phase and progress of the current or last backfill run of this module instance.",
        "operationId" : "keycloakBackfillStatus",
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/KeycloakBackfillStatusDto"
                }
              }
            },
            "description" : "Current backfill status"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "summary" : "Status of the Keycloak backfill run",
        "tags" : [ "br-users" ]
      },
      "post" : {
        "description" : "Starts a background run that syncs the role definitions, creates the missing Keycloak identities and the missing mod-users / mod-permissions records, and recomputes the Eureka roles of every BR user. Legacy bcrypt passwords are carried into Keycloak when its bcrypt password hash provider is installed, so imported users keep the password they have always used; without that provider — or without a usable stored hash — the user obtains a password through the reset flow instead. A password already set in Keycloak is never overwritten. Returns immediately; poll the GET variant for progress. A run that is already in progress is not started again — the call answers 202 with that run's status and changes nothing. A user created while a run is in progress may be missed by that run and is picked up by the next one. Idempotent — safe to re-run. FULL (default) performs the full drift repair, including legacy password checks. MISSING is the fast mode used by deploys: bulk state detection repairs only out-of-sync users and never re-checks passwords of existing linked Keycloak identities. Newly created identities receive the legacy hash as in FULL; conflict/adoption handling is identical.",
        "operationId" : "keycloakBackfill",
        "parameters" : [ {
          "explode" : true,
          "in" : "query",
          "name" : "mode",
          "required" : false,
          "schema" : {
            "allOf" : [ {
              "$ref" : "#/components/schemas/KeycloakBackfillModeDto"
            } ],
            "default" : "FULL"
          },
          "style" : "form"
        } ],
        "responses" : {
          "202" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/KeycloakBackfillStatusDto"
                }
              }
            },
            "description" : "Backfill running (started by this call or already in progress)"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "summary" : "Start the asynchronous Keycloak backfill of all BR users",
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/users/{userId}/organizations" : {
      "get" : {
        "description" : "Retrieve a list of organizations user belongs to with permitted roles.",
        "operationId" : "getUserOrganizationsCollection",
        "parameters" : [ {
          "description" : "The UUID of a user",
          "explode" : false,
          "in" : "path",
          "name" : "userId",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/userOrganizationsDtoCollection"
                }
              }
            },
            "description" : "Returns a user collection"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/users/{userId}/organizations/{orgId}" : {
      "delete" : {
        "description" : "Delete user's belonging to an organization",
        "operationId" : "deleteUserOrganization",
        "parameters" : [ {
          "description" : "The UUID of a user",
          "explode" : false,
          "in" : "path",
          "name" : "userId",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        }, {
          "description" : "The UUID of an organization",
          "explode" : false,
          "in" : "path",
          "name" : "orgId",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "responses" : {
          "204" : {
            "description" : "User's organization deleted successfully"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      },
      "put" : {
        "description" : "Set user's belonging to an organization with specified permitted roles",
        "operationId" : "setUserOrganization",
        "parameters" : [ {
          "description" : "The UUID of a user",
          "explode" : false,
          "in" : "path",
          "name" : "userId",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        }, {
          "description" : "The UUID of an organization",
          "explode" : false,
          "in" : "path",
          "name" : "orgId",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/RolesSet"
              }
            }
          },
          "description" : "Permitted roles for user in specified organization",
          "required" : true
        },
        "responses" : {
          "204" : {
            "description" : "User configured for given roles in an organization"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/users/{userId}/organizations/{orgId}/archive" : {
      "post" : {
        "description" : "Archive user's belonging to an organization",
        "operationId" : "archiveUserOrganization",
        "parameters" : [ {
          "description" : "The UUID of a user",
          "explode" : false,
          "in" : "path",
          "name" : "userId",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        }, {
          "description" : "The UUID of an organization",
          "explode" : false,
          "in" : "path",
          "name" : "orgId",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "responses" : {
          "200" : {
            "description" : "User's organization archived"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/users/{userId}/organizations/{orgId}/restore" : {
      "post" : {
        "description" : "Restore user's belonging to an organization",
        "operationId" : "restoreUserOrganization",
        "parameters" : [ {
          "description" : "The UUID of a user",
          "explode" : false,
          "in" : "path",
          "name" : "userId",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        }, {
          "description" : "The UUID of an organization",
          "explode" : false,
          "in" : "path",
          "name" : "orgId",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "responses" : {
          "200" : {
            "description" : "User's organization restored"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/select-organization" : {
      "post" : {
        "operationId" : "postBrUsersSelectOrganization",
        "parameters" : [ {
          "explode" : false,
          "in" : "header",
          "name" : "X-Okapi-Tenant",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "style" : "simple"
        }, {
          "explode" : false,
          "in" : "header",
          "name" : "X-Okapi-Token",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "style" : "simple"
        }, {
          "explode" : false,
          "in" : "header",
          "name" : "X-Okapi-URL",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "style" : "simple"
        } ],
        "requestBody" : {
          "$ref" : "#/components/requestBodies/SelectOrganizationBody"
        },
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/loginWithUserDto"
                }
              }
            },
            "description" : "Returns a login response with user details"
          },
          "400" : {
            "content" : {
              "text/plain" : {
                "example" : "You must provide a password"
              }
            },
            "description" : "Invalid request"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "summary" : "Select active organization of a logged in user",
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/_self" : {
      "get" : {
        "operationId" : "getBrUsersSelf",
        "parameters" : [ {
          "explode" : false,
          "in" : "header",
          "name" : "X-Okapi-Tenant",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "style" : "simple"
        }, {
          "explode" : false,
          "in" : "header",
          "name" : "X-Okapi-Token",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "style" : "simple"
        }, {
          "explode" : false,
          "in" : "header",
          "name" : "X-Okapi-URL",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "style" : "simple"
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/loginWithUserDto"
                }
              }
            },
            "description" : "Returns a login response with user details"
          },
          "400" : {
            "content" : {
              "text/plain" : {
                "example" : "You must provide a password"
              }
            },
            "description" : "Invalid request"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      },
      "put" : {
        "description" : "Update logged user",
        "operationId" : "putBrUsersSelf",
        "parameters" : [ {
          "explode" : false,
          "in" : "header",
          "name" : "X-Okapi-Tenant",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "style" : "simple"
        }, {
          "explode" : false,
          "in" : "header",
          "name" : "X-Okapi-Token",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "style" : "simple"
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/UserPersonal"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "204" : {
            "description" : "User successfully updated"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/organizations" : {
      "get" : {
        "description" : "Retrieve a list of organization items.",
        "operationId" : "getOrganizationCollection",
        "parameters" : [ {
          "description" : "A query expressed as a CQL string",
          "explode" : true,
          "in" : "query",
          "name" : "query",
          "required" : false,
          "schema" : {
            "default" : "cql.allRecords=1",
            "type" : "string"
          },
          "style" : "form"
        }, {
          "description" : "Skip over a number of elements by specifying an offset value for the query",
          "explode" : true,
          "in" : "query",
          "name" : "offset",
          "required" : false,
          "schema" : {
            "default" : 0,
            "maximum" : 2147483647,
            "minimum" : 0,
            "type" : "integer"
          },
          "style" : "form"
        }, {
          "description" : "Limit the number of elements returned in the response",
          "explode" : true,
          "in" : "query",
          "name" : "limit",
          "required" : false,
          "schema" : {
            "default" : 1000,
            "maximum" : 2147483647,
            "minimum" : 1,
            "type" : "integer"
          },
          "style" : "form"
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/organizationDtoCollection"
                }
              }
            },
            "description" : "Returns an organization collection"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "organizations" ]
      },
      "post" : {
        "description" : "Create a new organization.",
        "operationId" : "postOrganization",
        "requestBody" : {
          "$ref" : "#/components/requestBodies/OrganizationBody"
        },
        "responses" : {
          "201" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/OrganizationDto"
                }
              }
            },
            "description" : "Returns an organization"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "organizations" ]
      }
    },
    "/organizations/_similar" : {
      "get" : {
        "description" : "Find organizations with names similar to the given input. Returns exact matches (which would be rejected at save when source is empty) separately from token-overlap similar matches.",
        "operationId" : "getSimilarOrganizations",
        "parameters" : [ {
          "description" : "Candidate organization name to check for duplicates",
          "explode" : true,
          "in" : "query",
          "name" : "name",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "style" : "form"
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/similarOrganizationsDto"
                }
              }
            },
            "description" : "Returns organizations split into exact and similar matches"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "organizations" ]
      }
    },
    "/organizations/{id}" : {
      "delete" : {
        "description" : "Delete organization with given ID.",
        "operationId" : "deleteOrganizationById",
        "parameters" : [ {
          "description" : "The UUID of a organization",
          "explode" : false,
          "in" : "path",
          "name" : "id",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "responses" : {
          "204" : {
            "description" : "Organization deleted successfully"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "organizations" ]
      },
      "get" : {
        "description" : "Retrieve organization with given ID",
        "operationId" : "getOrganizationById",
        "parameters" : [ {
          "description" : "The UUID of a organization",
          "explode" : false,
          "in" : "path",
          "name" : "id",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/OrganizationDto"
                }
              }
            },
            "description" : "Returns an organization"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "organizations" ]
      },
      "put" : {
        "description" : "Update organization with given ID.",
        "operationId" : "putOrganizationById",
        "parameters" : [ {
          "description" : "The UUID of a organization",
          "explode" : false,
          "in" : "path",
          "name" : "id",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "requestBody" : {
          "$ref" : "#/components/requestBodies/OrganizationBody"
        },
        "responses" : {
          "204" : {
            "description" : "Organization successfully updated"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "409" : {
            "description" : "Organization was updated or deleted by another transaction"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "organizations" ]
      }
    },
    "/organizations/{id}/archive" : {
      "post" : {
        "description" : "Archive organization",
        "operationId" : "archiveOrganization",
        "parameters" : [ {
          "description" : "The UUID of an organization",
          "explode" : false,
          "in" : "path",
          "name" : "id",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "responses" : {
          "200" : {
            "description" : "Organization archived"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "organizations" ]
      }
    },
    "/organizations/{id}/restore" : {
      "post" : {
        "description" : "Restore organization",
        "operationId" : "restoreOrganization",
        "parameters" : [ {
          "description" : "The UUID of an organization",
          "explode" : false,
          "in" : "path",
          "name" : "id",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "responses" : {
          "200" : {
            "description" : "Organization restored"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "organizations" ]
      }
    },
    "/br-users/inbox" : {
      "post" : {
        "description" : "Accepts a POST request to process an event in the inbox.",
        "parameters" : [ {
          "explode" : false,
          "in" : "header",
          "name" : "X-Api-Key",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "style" : "simple"
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/InboxEventDto"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "content" : {
              "text/plain" : {
                "schema" : {
                  "example" : "Event received and processed.",
                  "type" : "string"
                }
              }
            },
            "description" : "Event received and processed."
          },
          "400" : {
            "description" : "Bad Request - Invalid input."
          },
          "500" : {
            "description" : "Internal Server Error - Failed to process event."
          }
        },
        "summary" : "Process an event in the inbox",
        "tags" : [ "br-users" ]
      }
    },
    "/audit-logs" : {
      "get" : {
        "description" : "Retrieve a list of audit logs.",
        "operationId" : "getAuditLogCollection",
        "parameters" : [ {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/auditLogSearchCriteria"
              }
            }
          },
          "in" : "query",
          "name" : "search",
          "required" : false
        }, {
          "explode" : true,
          "in" : "query",
          "name" : "offset",
          "required" : false,
          "schema" : {
            "default" : 0,
            "maximum" : 2147483647,
            "minimum" : 0,
            "type" : "integer"
          },
          "style" : "form"
        }, {
          "explode" : true,
          "in" : "query",
          "name" : "limit",
          "required" : false,
          "schema" : {
            "default" : 1000,
            "maximum" : 2147483647,
            "minimum" : 1,
            "type" : "integer"
          },
          "style" : "form"
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/auditLogDtoCollection"
                }
              }
            },
            "description" : "Returns an audit logs collection"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "audit-logs" ]
      }
    },
    "/audit-logs/count-by-user" : {
      "get" : {
        "description" : "Returns audit log counts grouped by user.",
        "operationId" : "getAuditLogCountByUser",
        "parameters" : [ {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/auditLogSearchCriteria"
              }
            }
          },
          "in" : "query",
          "name" : "search",
          "required" : false
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/auditLogCountByUserDto"
                }
              }
            },
            "description" : "Returns audit log counts grouped by user"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "audit-logs" ]
      }
    },
    "/br-users/users/my-profile" : {
      "get" : {
        "description" : "Retrieve user's personal information",
        "operationId" : "getMyProfile",
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/UserDto"
                }
              }
            },
            "description" : "Returns a user"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      },
      "put" : {
        "description" : "Update user's personal information",
        "operationId" : "putMyProfile",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/UserDto"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "204" : {
            "description" : "User successfully updated"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/users/my-organizations-count" : {
      "get" : {
        "description" : "Get the count of organizations for the current user",
        "operationId" : "getMyOrganizationsCount",
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/OrganizationCount"
                }
              }
            },
            "description" : "Organization count"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/users/my-sources-count" : {
      "get" : {
        "description" : "Get the count of sources for the current user",
        "operationId" : "getMySourcesCount",
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/UserSourceCount"
                }
              }
            },
            "description" : "User source count"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/users/{id}/organizations-count" : {
      "get" : {
        "description" : "Get the count of organizations for a user",
        "operationId" : "getUserOrganizationsCount",
        "parameters" : [ {
          "description" : "The UUID of a user",
          "explode" : false,
          "in" : "path",
          "name" : "id",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/OrganizationCount"
                }
              }
            },
            "description" : "Organization count"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/br-users/users/{id}/sources-count" : {
      "get" : {
        "description" : "Get the count of sources for a user",
        "operationId" : "getUserSourcesCount",
        "parameters" : [ {
          "description" : "The UUID of a user",
          "explode" : false,
          "in" : "path",
          "name" : "id",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "style" : "simple"
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/UserSourceCount"
                }
              }
            },
            "description" : "User source count"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "404" : {
            "content" : {
              "text/plain" : {
                "example" : "user not found"
              }
            },
            "description" : "Item with a given ID not found"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "tags" : [ "br-users" ]
      }
    },
    "/admin/environment-variables-users" : {
      "get" : {
        "description" : "Get environment variables",
        "operationId" : "getEnvironmentVariables",
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/environmentVariableDtoCollection"
                }
              }
            },
            "description" : "Returns a collection of environment variables"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "summary" : "Get environment variables",
        "tags" : [ "admin" ]
      }
    },
    "/admin/sync-to-legal-deposits" : {
      "post" : {
        "description" : "Writes all existing users and user organizations (with LEGAL_DEPOSITS source) to outbox for initial sync with mod-br-legaldeposits",
        "operationId" : "syncToLegalDeposits",
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/SyncResultDto"
                }
              }
            },
            "description" : "Sync completed successfully"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "summary" : "Sync all users and user organizations to legal deposits module",
        "tags" : [ "admin" ]
      }
    },
    "/admin/send-test-email" : {
      "post" : {
        "description" : "Sends a test email to the given address to verify the email configuration",
        "operationId" : "sendTestEmail",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/SendTestEmailDto"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "204" : {
            "description" : "Test email sent successfully"
          },
          "401" : {
            "content" : {
              "text/plain" : {
                "example" : "unable to perform action -- unauthorized"
              }
            },
            "description" : "Not authorized to perform requested action"
          },
          "422" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorsDto"
                }
              }
            },
            "description" : "Validation errors"
          },
          "500" : {
            "description" : "Unexpected error"
          }
        },
        "summary" : "Send a test email",
        "tags" : [ "admin" ]
      }
    }
  },
  "components" : {
    "requestBodies" : {
      "OrganizationBody" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/OrganizationDto"
            }
          }
        },
        "required" : true
      },
      "LoginBody" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/LoginCredentialsDto"
            }
          }
        },
        "description" : "Login credentials",
        "required" : true
      },
      "SelectOrganizationBody" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/SelectedOrganization"
            }
          }
        },
        "description" : "Selected organization",
        "required" : true
      }
    },
    "responses" : {
      "User" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/UserDto"
            }
          }
        },
        "description" : "Returns a user"
      },
      "UserCollection" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/userDtoCollection"
            }
          }
        },
        "description" : "Returns a user collection"
      },
      "UserOrganizationsCollection" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/userOrganizationsDtoCollection"
            }
          }
        },
        "description" : "Returns a user collection"
      },
      "Organization" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/OrganizationDto"
            }
          }
        },
        "description" : "Returns an organization"
      },
      "OrganizationCollection" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/organizationDtoCollection"
            }
          }
        },
        "description" : "Returns an organization collection"
      },
      "SimilarOrganizations" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/similarOrganizationsDto"
            }
          }
        },
        "description" : "Returns organizations split into exact and similar matches"
      },
      "UserTenantsCollection" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/userTenantsDtoCollection"
            }
          }
        },
        "description" : "Returns a user-tenant collection"
      },
      "UserPermissionsCollection" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/userPermissionsDtoCollection"
            }
          }
        },
        "description" : "Returns a user permissions collection"
      },
      "PermissionsCollection" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/permissionsDtoCollection"
            }
          }
        },
        "description" : "List of permissions, which can include nested permissions"
      },
      "LoginResponse" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/loginToken"
            }
          }
        },
        "description" : "Returns a login response"
      },
      "RefreshResponse" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/TokenExpiration"
            }
          }
        },
        "description" : "Returns a refresh response"
      },
      "LoginWithUserResponse" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/loginWithUserDto"
            }
          }
        },
        "description" : "Returns a login response with user details"
      },
      "AuditLogCountByUserResponse" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/auditLogCountByUserDto"
            }
          }
        },
        "description" : "Returns audit log counts grouped by user"
      },
      "AuditLogCollection" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/auditLogDtoCollection"
            }
          }
        },
        "description" : "Returns an audit logs collection"
      },
      "EnvironmentVariableCollection" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/environmentVariableDtoCollection"
            }
          }
        },
        "description" : "Returns a collection of environment variables"
      },
      "BadRequest" : {
        "content" : {
          "text/plain" : {
            "example" : "You must provide a password"
          }
        },
        "description" : "Invalid request"
      },
      "Unauthorized" : {
        "content" : {
          "text/plain" : {
            "example" : "unable to perform action -- unauthorized"
          }
        },
        "description" : "Not authorized to perform requested action"
      },
      "NotFound" : {
        "content" : {
          "text/plain" : {
            "example" : "user not found"
          }
        },
        "description" : "Item with a given ID not found"
      },
      "UnprocessableEntity" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "$ref" : "#/components/schemas/ErrorsDto"
            }
          }
        },
        "description" : "Validation errors"
      }
    },
    "schemas" : {
      "userSearchCriteria" : {
        "properties" : {
          "search" : {
            "description" : "A search term to search in email, firstName or lastName",
            "type" : "string"
          },
          "name" : {
            "description" : "A search term to search in firstName or lastName",
            "type" : "string"
          },
          "organization" : {
            "description" : "Return users within specified organization only",
            "type" : "string"
          },
          "archived" : {
            "description" : "Return users for archived organizations",
            "type" : "boolean"
          }
        },
        "type" : "object"
      },
      "userDtoCollection" : {
        "example" : {
          "users" : [ {
            "id" : "118dbd8c-5ba0-47a9-a850-34bbb1dbf3b7",
            "email" : "jan.novak@seznam.cz"
          }, {
            "id" : "46669e09-8b45-4ede-afbd-ca73bb89cdb3",
            "email" : "jana.novakova@seznam.cz"
          } ],
          "totalRecords" : 2
        },
        "properties" : {
          "users" : {
            "items" : {
              "$ref" : "#/components/schemas/UserDto"
            },
            "type" : "array"
          },
          "totalRecords" : {
            "description" : "Total amount of users",
            "readOnly" : true,
            "type" : "integer"
          }
        },
        "required" : [ "users" ],
        "title" : "Collection of users",
        "type" : "object"
      },
      "userOrganizationsDtoCollection" : {
        "properties" : {
          "userOrganizations" : {
            "items" : {
              "$ref" : "#/components/schemas/UserOrganizationDto"
            },
            "type" : "array"
          },
          "totalRecords" : {
            "description" : "Total amount of user's organizations",
            "readOnly" : true,
            "type" : "integer"
          }
        },
        "required" : [ "userOrganizations" ],
        "title" : "Collection of user's organizations",
        "type" : "object"
      },
      "organizationDtoCollection" : {
        "properties" : {
          "organizations" : {
            "items" : {
              "$ref" : "#/components/schemas/OrganizationDto"
            },
            "type" : "array"
          },
          "totalRecords" : {
            "description" : "Total amount of organizations",
            "readOnly" : true,
            "type" : "integer"
          }
        },
        "required" : [ "organizations" ],
        "title" : "Collection of organizations",
        "type" : "object"
      },
      "similarOrganizationsDto" : {
        "description" : "Result of a similarity check, partitioned into exact-name matches (would block save when source is empty) and other token-overlap similar matches",
        "properties" : {
          "exactMatches" : {
            "description" : "Organizations whose name equals the input case-insensitively and have no source set",
            "items" : {
              "$ref" : "#/components/schemas/OrganizationDto"
            },
            "type" : "array"
          },
          "similarMatches" : {
            "description" : "Organizations whose name shares all input tokens as whole words but is not an exact match",
            "items" : {
              "$ref" : "#/components/schemas/OrganizationDto"
            },
            "type" : "array"
          }
        },
        "required" : [ "exactMatches", "similarMatches" ],
        "title" : "Similar organizations result",
        "type" : "object"
      },
      "userTenantsDtoCollection" : {
        "properties" : {
          "totalRecords" : {
            "description" : "Total amount of user-tenants",
            "readOnly" : true,
            "type" : "integer"
          }
        },
        "title" : "Collection of user-tenants",
        "type" : "object"
      },
      "userPermissionsDtoCollection" : {
        "properties" : {
          "permissionNames" : {
            "items" : {
              "type" : "string"
            },
            "type" : "array"
          },
          "totalRecords" : {
            "description" : "Total number of user permissions",
            "readOnly" : true,
            "type" : "integer"
          }
        },
        "title" : "Collection of user permissions",
        "type" : "object"
      },
      "auditLogSearchCriteria" : {
        "properties" : {
          "userId" : {
            "type" : "string"
          },
          "entityName" : {
            "type" : "string"
          },
          "createTimeFrom" : {
            "type" : "string"
          },
          "createTimeTo" : {
            "type" : "string"
          },
          "entityId" : {
            "type" : "string"
          },
          "entityAction" : {
            "type" : "string"
          },
          "source" : {
            "enum" : [ "USERS", "PUBLISHERS", "LEGAL_DEPOSITS", "AGENCY" ],
            "type" : "string"
          },
          "dataContains" : {
            "description" : "Substring match on the data JSON field",
            "type" : "string"
          }
        },
        "type" : "object"
      },
      "permissionItemDto" : {
        "properties" : {
          "permissionName" : {
            "description" : "The name of the permission.",
            "type" : "string"
          },
          "permissionSub" : {
            "description" : "Subpermissions or additional permission details.",
            "items" : {
              "$ref" : "#/components/schemas/permissionItemDto_permissionSub_inner"
            },
            "type" : "array"
          }
        },
        "type" : "object"
      },
      "permissionsDtoCollection" : {
        "properties" : {
          "permissions" : {
            "description" : "List of permissions, which can include nested permissions.",
            "items" : {
              "$ref" : "#/components/schemas/permissionItemDto"
            },
            "type" : "array"
          }
        },
        "type" : "object"
      },
      "loginToken" : {
        "properties" : {
          "token" : {
            "description" : "The login token",
            "type" : "string"
          }
        },
        "type" : "object"
      },
      "loginWithUserDto" : {
        "properties" : {
          "user" : {
            "$ref" : "#/components/schemas/UserDetailDto"
          },
          "permissions" : {
            "$ref" : "#/components/schemas/UserPermissions"
          },
          "tokenExpiration" : {
            "$ref" : "#/components/schemas/TokenExpiration"
          },
          "userOrganizations" : {
            "items" : {
              "$ref" : "#/components/schemas/OrganizationDto"
            },
            "type" : "array"
          },
          "activeOrganization" : {
            "$ref" : "#/components/schemas/OrganizationDto"
          },
          "activeRoles" : {
            "items" : {
              "type" : "string"
            },
            "type" : "array"
          },
          "tenant" : {
            "type" : "string"
          }
        },
        "type" : "object"
      },
      "auditLogCountByUserDto" : {
        "properties" : {
          "totalCount" : {
            "description" : "Total count across all users",
            "type" : "integer"
          },
          "countsByUser" : {
            "items" : {
              "$ref" : "#/components/schemas/auditLogCountByUserDto_countsByUser_inner"
            },
            "type" : "array"
          }
        },
        "required" : [ "countsByUser", "totalCount" ],
        "title" : "Audit log counts grouped by user",
        "type" : "object"
      },
      "auditLogDtoCollection" : {
        "properties" : {
          "auditLogs" : {
            "items" : {
              "$ref" : "#/components/schemas/AuditLogDto"
            },
            "type" : "array"
          },
          "totalRecords" : {
            "description" : "Total amount of audit logs",
            "readOnly" : true,
            "type" : "integer"
          }
        },
        "required" : [ "auditLogs" ],
        "title" : "Collection of audit logs",
        "type" : "object"
      },
      "environmentVariableDtoCollection" : {
        "properties" : {
          "environmentVariables" : {
            "items" : {
              "$ref" : "#/components/schemas/EnvironmentVariableDto"
            },
            "type" : "array"
          }
        },
        "required" : [ "publisherUpdateRequests" ],
        "title" : "Collection of environment variables",
        "type" : "object"
      },
      "ErrorsDto" : {
        "example" : {
          "Error" : {
            "value" : {
              "errors" : [ {
                "message" : "may not be null",
                "type" : 1,
                "code" : -1,
                "parameters" : [ {
                  "key" : "moduleTo",
                  "value" : null
                } ]
              } ]
            }
          }
        },
        "type" : "object"
      },
      "UserCreateDto" : {
        "properties" : {
          "user" : {
            "$ref" : "#/components/schemas/UserDto"
          },
          "password" : {
            "minLength" : 8,
            "type" : "string"
          },
          "sendEmail" : {
            "type" : "boolean"
          }
        },
        "required" : [ "user" ],
        "title" : "UserCreate",
        "type" : "object"
      },
      "UserDto" : {
        "properties" : {
          "id" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "email" : {
            "format" : "email",
            "type" : "string"
          },
          "firstName" : {
            "type" : "string"
          },
          "lastName" : {
            "type" : "string"
          },
          "shouldChangePassword" : {
            "type" : "boolean"
          },
          "sources" : {
            "items" : {
              "$ref" : "#/components/schemas/UserSourceDto"
            },
            "type" : "array"
          },
          "active" : {
            "readOnly" : true,
            "type" : "boolean"
          },
          "version" : {
            "$ref" : "#/components/schemas/Version"
          }
        },
        "required" : [ "email", "firstName", "lastName" ],
        "title" : "User",
        "type" : "object"
      },
      "ChangeCurrentPasswordDto" : {
        "properties" : {
          "currentPassword" : {
            "type" : "string"
          },
          "newPassword" : {
            "minLength" : 8,
            "type" : "string"
          }
        },
        "required" : [ "currentPassword", "newPassword" ],
        "title" : "ChangeCurrentPassword",
        "type" : "object"
      },
      "RequestPasswordResetDto" : {
        "properties" : {
          "id" : {
            "description" : "Email address of the user requesting the password reset.",
            "format" : "email",
            "type" : "string"
          }
        },
        "required" : [ "id" ],
        "title" : "RequestPasswordReset",
        "type" : "object"
      },
      "LoginDiagnosticsRequestDto" : {
        "properties" : {
          "username" : {
            "description" : "The login name (e-mail) whose failed login should be diagnosed. Must not be blank.",
            "example" : "user@example.cz",
            "pattern" : "^[\\s\\S]*\\S[\\s\\S]*$",
            "type" : "string"
          }
        },
        "required" : [ "username" ],
        "title" : "LoginDiagnosticsRequest",
        "type" : "object"
      },
      "LoginDiagnosticsErrorsDto" : {
        "description" : "Legacy ReČeK login error body. Contains exactly one error whose type identifies the cause of the failed login; the login form maps it to a specific message.",
        "example" : {
          "errors" : [ {
            "type" : "-5"
          } ]
        },
        "properties" : {
          "errors" : {
            "items" : {
              "$ref" : "#/components/schemas/LoginDiagnosticsErrorDto"
            },
            "maxItems" : 1,
            "minItems" : 1,
            "type" : "array"
          }
        },
        "required" : [ "errors" ],
        "title" : "LoginDiagnosticsErrors",
        "type" : "object"
      },
      "ValidatePasswordResetTokenDto" : {
        "properties" : {
          "token" : {
            "description" : "The password-reset token received in the emailed link.",
            "type" : "string"
          }
        },
        "required" : [ "token" ],
        "title" : "ValidatePasswordResetToken",
        "type" : "object"
      },
      "ResetPasswordWithTokenDto" : {
        "properties" : {
          "token" : {
            "description" : "The token sent via email for password reset.",
            "type" : "string"
          },
          "newPassword" : {
            "description" : "The new password to set.",
            "minLength" : 8,
            "type" : "string"
          }
        },
        "required" : [ "newPassword", "token" ],
        "title" : "ResetPasswordWithToken",
        "type" : "object"
      },
      "uuid" : {
        "example" : "46669e09-8b45-4ede-afbd-ca73bb89cdb3",
        "pattern" : "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
        "type" : "string"
      },
      "ResetUserPasswordDto" : {
        "properties" : {
          "newPassword" : {
            "minLength" : 8,
            "type" : "string"
          },
          "sendEmail" : {
            "type" : "boolean"
          }
        },
        "required" : [ "newPassword" ],
        "title" : "ResetUserPassword",
        "type" : "object"
      },
      "KeycloakRoleSyncResultDto" : {
        "description" : "Summary of a role-definition sync into mod-roles-keycloak",
        "properties" : {
          "roles" : {
            "description" : "Per-role outcome",
            "items" : {
              "$ref" : "#/components/schemas/KeycloakRoleSyncRoleDto"
            },
            "type" : "array"
          },
          "brCapabilitiesGrantedToNoRole" : {
            "description" : "mod-br-* capabilities no managed role holds, sorted by permission name. Such an endpoint is unreachable for every user on Eureka, so the list points at gaps in Permissions.java.",
            "items" : {
              "type" : "string"
            },
            "type" : "array"
          }
        },
        "required" : [ "brCapabilitiesGrantedToNoRole", "roles" ],
        "title" : "Keycloak role sync result",
        "type" : "object"
      },
      "KeycloakBackfillStatusDto" : {
        "description" : "State of the asynchronous Keycloak backfill run. The state is held per module instance, so with more than one replica the status may be served by a pod that did not run the backfill.",
        "properties" : {
          "mode" : {
            "$ref" : "#/components/schemas/KeycloakBackfillModeDto"
          },
          "state" : {
            "description" : "Run state",
            "enum" : [ "IDLE", "RUNNING", "FINISHED", "FAILED" ],
            "type" : "string"
          },
          "phase" : {
            "description" : "Phase the run is in (null before it starts and after it ends)",
            "enum" : [ "ROLE_DEFINITIONS", "IDENTITIES", "USER_ROLES" ],
            "type" : "string"
          },
          "startedAt" : {
            "description" : "When the current or last run started",
            "format" : "date-time",
            "type" : "string"
          },
          "finishedAt" : {
            "description" : "When the last run ended",
            "format" : "date-time",
            "type" : "string"
          },
          "processedUsers" : {
            "description" : "Users processed so far in the current phase",
            "type" : "integer"
          },
          "totalUsers" : {
            "description" : "Total number of BR users",
            "type" : "integer"
          },
          "result" : {
            "$ref" : "#/components/schemas/KeycloakBackfillResultDto"
          },
          "error" : {
            "description" : "Failure reason when the state is FAILED",
            "type" : "string"
          }
        },
        "required" : [ "processedUsers", "state", "totalUsers" ],
        "title" : "Keycloak backfill status",
        "type" : "object"
      },
      "KeycloakBackfillModeDto" : {
        "description" : "Backfill mode (FULL repairs all drift; MISSING uses bulk detection).",
        "enum" : [ "FULL", "MISSING" ],
        "type" : "string"
      },
      "RolesSet" : {
        "properties" : {
          "roles" : {
            "description" : "A list of role codes",
            "items" : {
              "type" : "string"
            },
            "type" : "array"
          }
        },
        "title" : "RolesSet",
        "type" : "object"
      },
      "UserPersonal" : {
        "properties" : {
          "firstName" : {
            "type" : "string"
          },
          "lastName" : {
            "type" : "string"
          },
          "email" : {
            "format" : "email",
            "type" : "string"
          }
        },
        "title" : "UserPersonal",
        "type" : "object"
      },
      "OrganizationDto" : {
        "properties" : {
          "id" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "name" : {
            "type" : "string"
          },
          "source" : {
            "enum" : [ "PUBLISHERS", "LEGAL_DEPOSITS" ],
            "type" : "string"
          },
          "sourceId" : {
            "type" : "string"
          },
          "archived" : {
            "type" : "boolean"
          },
          "adminResolved" : {
            "type" : "boolean"
          },
          "version" : {
            "$ref" : "#/components/schemas/Version"
          }
        },
        "required" : [ "name" ],
        "title" : "Organization",
        "type" : "object"
      },
      "InboxEventDto" : {
        "properties" : {
          "id" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "type" : {
            "type" : "string"
          },
          "source" : {
            "type" : "string"
          },
          "payload" : {
            "type" : "string"
          },
          "userId" : {
            "$ref" : "#/components/schemas/uuid"
          }
        },
        "title" : "InboxEvent",
        "type" : "object"
      },
      "OrganizationCount" : {
        "properties" : {
          "count" : {
            "description" : "Number of organizations the current user belongs to",
            "type" : "integer"
          }
        },
        "required" : [ "count" ],
        "type" : "object"
      },
      "UserSourceCount" : {
        "properties" : {
          "count" : {
            "description" : "Number of sources the current user has",
            "type" : "integer"
          }
        },
        "required" : [ "count" ],
        "type" : "object"
      },
      "SyncResultDto" : {
        "properties" : {
          "usersCount" : {
            "description" : "Number of users synced",
            "type" : "integer"
          },
          "userOrganizationsCount" : {
            "description" : "Number of user organizations synced",
            "type" : "integer"
          }
        },
        "type" : "object"
      },
      "SendTestEmailDto" : {
        "properties" : {
          "to" : {
            "description" : "Recipient email address for the test email.",
            "format" : "email",
            "type" : "string"
          }
        },
        "required" : [ "to" ],
        "title" : "SendTestEmail",
        "type" : "object"
      },
      "TokenExpiration" : {
        "properties" : {
          "refreshTokenExpiration" : {
            "type" : "string"
          },
          "accessTokenExpiration" : {
            "type" : "string"
          }
        },
        "title" : "TokenExpiration",
        "type" : "object"
      },
      "LoginCredentialsDto" : {
        "properties" : {
          "username" : {
            "type" : "string"
          },
          "password" : {
            "type" : "string"
          }
        },
        "required" : [ "password", "username" ],
        "type" : "object"
      },
      "UserOrganizationDto" : {
        "properties" : {
          "id" : {
            "readOnly" : true,
            "type" : "integer"
          },
          "organization" : {
            "$ref" : "#/components/schemas/OrganizationDto"
          },
          "user" : {
            "$ref" : "#/components/schemas/UserDto"
          },
          "roles" : {
            "description" : "A list of role codes the user has within this organization.",
            "items" : {
              "type" : "string"
            },
            "type" : "array"
          },
          "archived" : {
            "type" : "boolean"
          }
        },
        "required" : [ "organization", "user" ],
        "title" : "UserOrganization",
        "type" : "object"
      },
      "UserDetailDto" : {
        "properties" : {
          "username" : {
            "type" : "string"
          },
          "id" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "shouldChangePassword" : {
            "readOnly" : true,
            "type" : "boolean"
          },
          "personal" : {
            "$ref" : "#/components/schemas/UserPersonal"
          }
        },
        "title" : "UserDetails",
        "type" : "object"
      },
      "AuditLogDto" : {
        "properties" : {
          "id" : {
            "type" : "integer"
          },
          "createTime" : {
            "format" : "date-time",
            "type" : "string"
          },
          "entityName" : {
            "type" : "string"
          },
          "entityAction" : {
            "type" : "string"
          },
          "entityId" : {
            "type" : "string"
          },
          "user" : {
            "$ref" : "#/components/schemas/UserDto"
          },
          "data" : {
            "type" : "string"
          },
          "source" : {
            "enum" : [ "USERS", "PUBLISHERS", "LEGAL_DEPOSITS", "AGENCY" ],
            "type" : "string"
          }
        },
        "title" : "AuditLog",
        "type" : "object"
      },
      "EnvironmentVariableDto" : {
        "properties" : {
          "name" : {
            "type" : "string"
          },
          "value" : {
            "type" : "string"
          }
        },
        "type" : "object"
      },
      "UserSourceDto" : {
        "properties" : {
          "source" : {
            "type" : "string"
          },
          "sourceId" : {
            "type" : "string"
          }
        },
        "title" : "UserSource",
        "type" : "object"
      },
      "Version" : {
        "description" : "Optimistic locking version for the entity",
        "example" : 1,
        "format" : "int32",
        "readOnly" : true,
        "type" : "integer"
      },
      "LoginDiagnosticsErrorDto" : {
        "properties" : {
          "type" : {
            "description" : "Legacy ReČeK error type: -5 = unknown username (\"Neplatné uživatelské jméno\"), -6 = existing enabled user, i.e. wrong password (\"Neplatné heslo\"), -7 = existing but disabled user (\"Ztráta přístupu - ukončení činnosti garanta\").",
            "enum" : [ "-5", "-6", "-7" ],
            "type" : "string"
          }
        },
        "required" : [ "type" ],
        "title" : "LoginDiagnosticsError",
        "type" : "object"
      },
      "KeycloakRoleSyncRoleDto" : {
        "description" : "Outcome of mirroring one br role into mod-roles-keycloak",
        "properties" : {
          "name" : {
            "description" : "Eureka role name (br-<RoleCode>)",
            "type" : "string"
          },
          "roleId" : {
            "description" : "Eureka role id",
            "type" : "string"
          },
          "created" : {
            "description" : "Whether the role did not exist yet and was created by this run",
            "type" : "boolean"
          },
          "changed" : {
            "description" : "Whether the role capabilities were rewritten (they already matched otherwise)",
            "type" : "boolean"
          },
          "capabilityCount" : {
            "description" : "Number of capabilities the role now carries",
            "type" : "integer"
          },
          "unresolvedPermissions" : {
            "description" : "Permission names no grantable capability matched, sorted",
            "items" : {
              "type" : "string"
            },
            "type" : "array"
          }
        },
        "required" : [ "capabilityCount", "changed", "created", "name", "roleId", "unresolvedPermissions" ],
        "title" : "Keycloak role sync - single role",
        "type" : "object"
      },
      "KeycloakBackfillResultDto" : {
        "description" : "Summary of a Keycloak backfill run (idempotent — safe to re-run). In MISSING mode, credential counters cover only identities passed to repair; existing linked identities are not examined and do not increment any credential counter.",
        "properties" : {
          "total" : {
            "description" : "Number of BR users processed",
            "type" : "integer"
          },
          "created" : {
            "description" : "Number of Keycloak users created",
            "type" : "integer"
          },
          "existing" : {
            "description" : "Number of users that already had a Keycloak identity",
            "type" : "integer"
          },
          "failed" : {
            "description" : "Number of users that could not be processed",
            "type" : "integer"
          },
          "failures" : {
            "description" : "Per-user failure detail",
            "items" : {
              "$ref" : "#/components/schemas/KeycloakBackfillFailureDto"
            },
            "type" : "array"
          },
          "credentials" : {
            "$ref" : "#/components/schemas/KeycloakBackfillCredentialsDto"
          },
          "platformUsers" : {
            "$ref" : "#/components/schemas/KeycloakBackfillPlatformUsersDto"
          },
          "roles" : {
            "$ref" : "#/components/schemas/KeycloakBackfillRolesDto"
          }
        },
        "required" : [ "created", "credentials", "existing", "failed", "failures", "platformUsers", "roles", "total" ],
        "title" : "Keycloak backfill result",
        "type" : "object"
      },
      "KeycloakBackfillFailureDto" : {
        "description" : "A single BR user that could not be backfilled into Keycloak",
        "properties" : {
          "userId" : {
            "description" : "The BR user id that failed",
            "type" : "string"
          },
          "message" : {
            "description" : "The failure reason (never contains secrets)",
            "type" : "string"
          }
        },
        "required" : [ "message", "userId" ],
        "title" : "Keycloak backfill failure",
        "type" : "object"
      },
      "KeycloakBackfillCredentialsDto" : {
        "description" : "How many stored bcrypt passwords the run carried into Keycloak",
        "properties" : {
          "imported" : {
            "description" : "Number of users whose stored password became their Keycloak password",
            "type" : "integer"
          },
          "existing" : {
            "description" : "Number of users who already had a Keycloak password (never overwritten)",
            "type" : "integer"
          },
          "skipped" : {
            "description" : "Number of users with nothing importable - no usable stored hash, or Keycloak has no bcrypt password hash provider; those users obtain a password through the reset flow",
            "type" : "integer"
          }
        },
        "required" : [ "existing", "imported", "skipped" ],
        "title" : "Keycloak backfill - legacy password summary",
        "type" : "object"
      },
      "KeycloakBackfillPlatformUsersDto" : {
        "description" : "How the mod-users mirror of the identity phase went",
        "properties" : {
          "created" : {
            "description" : "Number of mod-users records created",
            "type" : "integer"
          },
          "existing" : {
            "description" : "Number of users that already had a mod-users record",
            "type" : "integer"
          },
          "failed" : {
            "description" : "Number of users whose mod-users record could not be ensured",
            "type" : "integer"
          }
        },
        "required" : [ "created", "existing", "failed" ],
        "title" : "Keycloak backfill - platform user summary",
        "type" : "object"
      },
      "KeycloakBackfillRolesDto" : {
        "description" : "How the user-role phase of a backfill run went",
        "properties" : {
          "synced" : {
            "description" : "Number of users whose Eureka roles were recomputed",
            "type" : "integer"
          },
          "changed" : {
            "description" : "Number of users whose Eureka role assignment actually changed",
            "type" : "integer"
          },
          "failed" : {
            "description" : "Number of users whose role sync failed",
            "type" : "integer"
          }
        },
        "required" : [ "changed", "failed", "synced" ],
        "title" : "Keycloak backfill - user role summary",
        "type" : "object"
      },
      "SelectedOrganization" : {
        "properties" : {
          "organizationId" : {
            "$ref" : "#/components/schemas/uuid"
          }
        },
        "title" : "SelectedOrganization",
        "type" : "object"
      },
      "permissionItemDto_permissionSub_inner" : {
        "oneOf" : [ {
          "type" : "string"
        }, {
          "$ref" : "#/components/schemas/permissionItemDto"
        } ]
      },
      "UserPermission" : {
        "properties" : {
          "permissionName" : {
            "description" : "The name of the permission.",
            "type" : "string"
          }
        },
        "title" : "UserPermission",
        "type" : "object"
      },
      "UserPermissions" : {
        "properties" : {
          "userId" : {
            "$ref" : "#/components/schemas/uuid"
          },
          "permissions" : {
            "description" : "An array of permissions granted to the user.",
            "items" : {
              "$ref" : "#/components/schemas/UserPermission"
            },
            "type" : "array"
          }
        },
        "title" : "UserPermissions",
        "type" : "object"
      },
      "auditLogCountByUserDto_countsByUser_inner" : {
        "properties" : {
          "userId" : {
            "type" : "string"
          },
          "firstName" : {
            "type" : "string"
          },
          "lastName" : {
            "type" : "string"
          },
          "count" : {
            "type" : "integer"
          }
        },
        "type" : "object"
      }
    }
  }
}