{
  "openapi": "3.0.2",
  "info": {
    "title": "Movary",
    "version": ""
  },
  "servers": [],
  "tags": [
    {"name": "Me"},
    {"name": "Users"},
    {"name": "Dashboard"},
    {"name": "Movies"},
    {"name": "Persons"},
    {"name": "Plays"},
    {"name": "Watchlist"},
    {"name": "Locations"},
    {"name": "Reviews"},
    {"name": "Ratings"},
    {"name": "Webhooks"},
    {"name": "Radarr"},
    {"name": "Admin users"},
    {"name": "Admin server"}
  ],
  "paths": {
      "/api/v1/admin/server/email": {
        "get": {
          "tags": [
            "Admin server"
          ],
          "operationId": "getServerEmailSettings",
          "summary": "Get server email settings without credentials",
          "description": "Administrator token required. Returns effective settings and credential presence flags; never returns the SMTP username or password. Uses Cache-Control: no-store.",
          "responses": {
            "200": {
              "description": "Effective email settings",
              "headers": {
                "Cache-Control": {
                  "schema": {
                    "type": "string",
                    "enum": [
                      "no-store"
                    ]
                  }
                }
              },
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/serverEmailSettings"
                  }
                }
              }
            },
            "401": {
              "$ref": "#/components/responses/401"
            },
            "403": {
              "$ref": "#/components/responses/403"
            }
          },
          "security": [
            {
              "bearerToken": []
            },
            {
              "movaryToken": []
            }
          ]
        },
        "patch": {
          "tags": [
            "Admin server"
          ],
          "operationId": "updateServerEmailSettings",
          "summary": "Update supplied server email settings",
          "description": "Administrator token required. Omitted fields, including credentials, retain their current values. Rejects any supplied environment-controlled field with 409 before saving. Validates the resulting SMTP configuration before writing when email is enabled or SMTP fields are supplied. Set smtpEncryption to an empty string for no encryption. Disabling SMTP authentication clears database credentials not controlled by the environment; credential fields are only saved when authentication is enabled. Disabling email preserves SMTP settings and invalidates pending password reset tokens; it is rejected while EMAIL_VERIFICATION_REQUIRED=1.",
          "requestBody": {
            "required": true,
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/serverEmailSettingsUpdate"
                }
              }
            }
          },
          "responses": {
            "204": {
              "description": "Email settings updated"
            },
            "400": {
              "$ref": "#/components/responses/400"
            },
            "401": {
              "$ref": "#/components/responses/401"
            },
            "403": {
              "$ref": "#/components/responses/403"
            },
            "409": {
              "description": "An affected field is controlled by an environment variable, or disabling email conflicts with required email verification."
            }
          },
          "security": [
            {
              "bearerToken": []
            },
            {
              "movaryToken": []
            }
          ]
        },
        "delete": {
          "tags": [
            "Admin server"
          ],
          "operationId": "deleteServerEmailSettings",
          "summary": "Disable email and remove stored SMTP configuration",
          "description": "Administrator token required. Removes all database-stored SMTP settings, disables email, and invalidates pending password reset tokens. Returns 409 without changes if any email or SMTP field is controlled by an environment variable, or EMAIL_VERIFICATION_REQUIRED=1. Repeated deletion returns 204.",
          "responses": {
            "204": {
              "description": "Email disabled and stored SMTP configuration removed"
            },
            "401": {
              "$ref": "#/components/responses/401"
            },
            "403": {
              "$ref": "#/components/responses/403"
            },
            "409": {
              "description": "An affected field is controlled by an environment variable, or disabling email conflicts with required email verification."
            }
          },
          "security": [
            {
              "bearerToken": []
            },
            {
              "movaryToken": []
            }
          ]
        }
      },
      "/api/v1/admin/users": {
        "get": {
          "tags": ["Admin users"], "operationId": "getAdminUsers", "summary": "List all user accounts",
          "parameters": [
            {"name": "page", "in": "query", "schema": {"type": "integer", "minimum": 1, "default": 1}},
            {"name": "limit", "in": "query", "schema": {"type": "integer", "minimum": 1, "maximum": 100, "default": 24}},
            {"name": "role", "in": "query", "schema": {"type": "string", "enum": ["admin", "user"]}}
          ],
          "responses": {
            "200": {"description": "Paginated account list", "content": {"application/json": {"schema": {"type": "object", "required": ["users", "page", "limit", "total"], "properties": {"users": {"type": "array", "items": {"$ref": "#/components/schemas/adminUserListEntry"}}, "page": {"type": "integer"}, "limit": {"type": "integer"}, "total": {"type": "integer"}}}}}},
            "400": {"$ref": "#/components/responses/400"}, "401": {"$ref": "#/components/responses/401"}, "403": {"$ref": "#/components/responses/403"}
          },
          "security": [{"bearerToken": []}, {"movaryToken": []}]
        },
        "post": {
          "tags": ["Admin users"], "operationId": "createAdminUser", "summary": "Create a user account",
          "description": "isEnabled and emailVerified default to true when omitted.",
          "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/adminUserCreate"}}}},
          "responses": {
            "201": {"description": "Account created", "content": {"application/json": {"schema": {"type": "object", "required": ["user"], "properties": {"user": {"$ref": "#/components/schemas/adminUser"}}}}}},
            "400": {"$ref": "#/components/responses/400"}, "401": {"$ref": "#/components/responses/401"}, "403": {"$ref": "#/components/responses/403"}
          },
          "security": [{"bearerToken": []}, {"movaryToken": []}]
        }
      },
      "/api/v1/admin/users/{userId}": {
        "parameters": [{"name": "userId", "in": "path", "required": true, "schema": {"type": "integer", "minimum": 1}}],
        "get": {
          "tags": ["Admin users"], "operationId": "getAdminUser", "summary": "Get a user account",
          "responses": {"200": {"description": "Account", "content": {"application/json": {"schema": {"type": "object", "required": ["user"], "properties": {"user": {"$ref": "#/components/schemas/adminUser"}}}}}}, "401": {"$ref": "#/components/responses/401"}, "403": {"$ref": "#/components/responses/403"}, "404": {"$ref": "#/components/responses/404"}},
          "security": [{"bearerToken": []}, {"movaryToken": []}]
        },
        "patch": {
          "tags": ["Admin users"], "operationId": "updateAdminUser", "summary": "Update supplied user account fields",
          "description": "An administrator cannot disable their own account. Email changes follow the configured verification policy. A password change ends the user's web sessions but leaves personal API tokens active.",
          "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/adminUserUpdate"}}}},
          "responses": {"204": {"description": "Account updated"}, "400": {"$ref": "#/components/responses/400"}, "401": {"$ref": "#/components/responses/401"}, "403": {"$ref": "#/components/responses/403"}, "404": {"$ref": "#/components/responses/404"}},
          "security": [{"bearerToken": []}, {"movaryToken": []}]
        },
        "delete": {
          "tags": ["Admin users"], "operationId": "deleteAdminUser", "summary": "Delete a user account",
          "responses": {"204": {"description": "Account deleted"}, "401": {"$ref": "#/components/responses/401"}, "403": {"$ref": "#/components/responses/403"}, "404": {"$ref": "#/components/responses/404"}},
          "security": [{"bearerToken": []}, {"movaryToken": []}]
        }
      },
      "/api/v1/users": {
        "get": {
          "tags": ["Users"],
          "operationId": "getVisibleUsers",
          "summary": "Get users visible to the API token owner",
          "description": "Returns usernames of accounts visible to signed-in users, plus the token owner's own account even when it is private. Usernames are sorted alphabetically.",
          "responses": {
            "200": {
              "description": "Visible usernames",
              "content": {"application/json": {"schema": {"$ref": "#/components/schemas/visibleUsers"}}}
            },
            "401": {"$ref": "#/components/responses/401"},
            "500": {"$ref": "#/components/responses/500"}
          },
          "security": [{"bearerToken": []}, {"movaryToken": []}]
        }
      },
      "/api/v1/users/{username}/dashboard/overview": {
        "get": {
          "tags": ["Dashboard"],
          "operationId": "getUserDashboardOverview",
          "summary": "Get dashboard overview statistics",
          "description": "Get the six overview values shown on the specified user's dashboard when their privacy setting permits access.",
          "parameters": [{"$ref": "#/components/parameters/username"}],
          "responses": {
            "200": {
              "description": "Dashboard overview statistics",
              "content": {"application/json": {"schema": {"$ref": "#/components/schemas/dashboardOverview"}}}
            },
            "401": {"$ref": "#/components/responses/401"},
            "403": {"$ref": "#/components/responses/403"},
            "404": {"$ref": "#/components/responses/404"},
            "500": {"$ref": "#/components/responses/500"}
          },
          "security": [{"bearerToken": []}, {"movaryToken": []}]
        }
      },
      "/api/v1/users/{username}/dashboard/rows": {
        "get": {
          "tags": [
            "Dashboard"
          ],
          "operationId": "getUserDashboardRows",
          "summary": "Get dashboard row configuration",
          "parameters": [
            {
              "name": "username",
              "in": "path",
              "required": true,
              "schema": {
                "type": "string"
              }
            }
          ],
          "responses": {
            "200": {
              "description": "Configured dashboard rows, including hidden rows",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/dashboardRowsManifest"
                  }
                }
              }
            },
            "401": {
              "$ref": "#/components/responses/401"
            },
            "403": {
              "$ref": "#/components/responses/403"
            },
            "404": {
              "$ref": "#/components/responses/404"
            },
            "500": {
              "$ref": "#/components/responses/500"
            }
          },
          "security": [
            {
              "bearerToken": []
            },
            {
              "movaryToken": []
            }
          ]
        },
        "put": {
          "tags": ["Dashboard"],
          "operationId": "updateUserDashboardRows",
          "summary": "Replace dashboard row configuration",
          "description": "The token must belong to the specified user. Submit every row exactly once with a unique zero-based position.",
          "parameters": [{"$ref": "#/components/parameters/username"}],
          "requestBody": {
            "required": true,
            "content": {"application/json": {"schema": {"$ref": "#/components/schemas/dashboardRowsUpdate"}}}
          },
          "responses": {
            "204": {"description": "Dashboard rows updated"},
            "400": {"$ref": "#/components/responses/400"},
            "401": {"$ref": "#/components/responses/401"},
            "403": {"$ref": "#/components/responses/403"},
            "404": {"$ref": "#/components/responses/404"},
            "500": {"$ref": "#/components/responses/500"}
          },
          "security": [{"bearerToken": []}, {"movaryToken": []}]
        },
        "delete": {
          "tags": ["Dashboard"],
          "operationId": "resetUserDashboardRows",
          "summary": "Restore default dashboard row configuration",
          "description": "The token must belong to the specified user.",
          "parameters": [{"$ref": "#/components/parameters/username"}],
          "responses": {
            "204": {"description": "Dashboard rows reset"},
            "401": {"$ref": "#/components/responses/401"},
            "403": {"$ref": "#/components/responses/403"},
            "404": {"$ref": "#/components/responses/404"},
            "500": {"$ref": "#/components/responses/500"}
          },
          "security": [{"bearerToken": []}, {"movaryToken": []}]
        }
      },
      "/api/v1/users/{username}/dashboard/rows/{rowKey}": {
        "get": {
          "tags": [
            "Dashboard"
          ],
          "operationId": "getUserDashboardRow",
          "summary": "Get one visible dashboard row",
          "description": "Actor, actress, and director rows use the API token owner's hidden-person settings. Hidden rows return 404.",
          "parameters": [
            {
              "name": "username",
              "in": "path",
              "required": true,
              "schema": {
                "type": "string"
              }
            },
            {
              "name": "rowKey",
              "in": "path",
              "required": true,
              "schema": {
                "type": "string",
                "enum": [
                  "last-plays",
                  "last-plays-cinema",
                  "most-watched-actors",
                  "most-watched-actresses",
                  "most-watched-directors",
                  "most-watched-genres",
                  "most-watched-languages",
                  "most-watched-production-companies",
                  "most-watched-production-countries",
                  "most-watched-release-years",
                  "latest-watchlist",
                  "top-locations",
                  "personal-rating-distribution"
                ]
              }
            }
          ],
          "responses": {
            "200": {
              "description": "Dashboard row data",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/dashboardRowResponse"
                  }
                }
              }
            },
            "401": {
              "$ref": "#/components/responses/401"
            },
            "403": {
              "$ref": "#/components/responses/403"
            },
            "404": {
              "$ref": "#/components/responses/404"
            },
            "500": {
              "$ref": "#/components/responses/500"
            }
          },
          "security": [
            {
              "bearerToken": []
            },
            {
              "movaryToken": []
            }
          ]
        }
      },
    "\/api\/v1\/users\/{username}\/plays": {
      "get": {
        "tags": [
          "Plays"
        ],
        "operationId": "getUserPlays",
        "summary": "Get individual plays of user",
        "description": "Returns one item per play, including plays with unknown dates. Sorted by watch date, position, and play ID.",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 24
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application\/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "plays",
                    "currentPage",
                    "maxPage"
                  ],
                  "properties": {
                    "plays": {
                      "type": "array",
                      "items": {
                        "$ref": "#\/components\/schemas\/play"
                      }
                    },
                    "currentPage": {
                      "type": "integer"
                    },
                    "maxPage": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#\/components\/responses\/401"
          },
          "403": {
            "$ref": "#\/components\/responses\/403"
          },
          "404": {
            "$ref": "#\/components\/responses\/404"
          },
          "500": {
            "$ref": "#\/components\/responses\/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      },
      "post": {
        "tags": [
          "Plays"
        ],
        "operationId": "createUserPlay",
        "summary": "Create one play for a user",
        "description": "Creates exactly one play, including one with an unknown watch date. The movie is removed from the watchlist automatically.",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application\/json": {
              "schema": {
                "$ref": "#\/components\/schemas\/playCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Play created",
            "headers": {
              "Location": {
                "description": "URL of the new play",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application\/json": {
                "schema": {
                  "$ref": "#\/components\/schemas\/play"
                }
              }
            }
          },
          "400": {
            "$ref": "#\/components\/responses\/400"
          },
          "401": {
            "$ref": "#\/components\/responses\/401"
          },
          "403": {
            "$ref": "#\/components\/responses\/403"
          },
          "404": {
            "$ref": "#\/components\/responses\/404"
          },
          "500": {
            "$ref": "#\/components\/responses\/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      }
    },
    "\/api\/v1\/users\/{username}\/plays\/{playId}": {
      "get": {
        "tags": [
          "Plays"
        ],
        "operationId": "getUserPlay",
        "summary": "Get one individual play",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "playId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application\/json": {
                "schema": {
                  "$ref": "#\/components\/schemas\/play"
                }
              }
            }
          },
          "401": {
            "$ref": "#\/components\/responses\/401"
          },
          "403": {
            "$ref": "#\/components\/responses\/403"
          },
          "404": {
            "$ref": "#\/components\/responses\/404"
          },
          "500": {
            "$ref": "#\/components\/responses\/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      },
      "put": {
        "tags": [
          "Plays"
        ],
        "operationId": "updateUserPlay",
        "summary": "Replace one individual play",
        "description": "All fields are required. The location must belong to the user. This operation does not change other plays on the same date.",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "playId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application\/json": {
              "schema": {
                "$ref": "#\/components\/schemas\/playUpdate"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Successful operation"
          },
          "400": {
            "$ref": "#\/components\/responses\/400"
          },
          "401": {
            "$ref": "#\/components\/responses\/401"
          },
          "403": {
            "$ref": "#\/components\/responses\/403"
          },
          "404": {
            "$ref": "#\/components\/responses\/404"
          },
          "500": {
            "$ref": "#\/components\/responses\/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Plays"
        ],
        "operationId": "deleteUserPlay",
        "summary": "Delete one individual play",
        "description": "Deletes only the play identified by playId.",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "playId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful operation"
          },
          "401": {
            "$ref": "#\/components\/responses\/401"
          },
          "403": {
            "$ref": "#\/components\/responses\/403"
          },
          "404": {
            "$ref": "#\/components\/responses\/404"
          },
          "500": {
            "$ref": "#\/components\/responses\/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      }
    },
    "\/api\/v1\/users\/{username}\/watchlist": {
      "get": {
        "tags": [
          "Watchlist"
        ],
        "operationId": "getUserWatchlist",
        "summary": "Get movies in watchlist of user",
        "description": "Get all movies on the user watchlist. Sorted by most recently added on default.",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "description": "Name of user",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "The search term",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Page",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 24
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "description": "Sort by",
            "required": false,
            "schema": {
              "type": "string",
              "default": "addedAt",
              "enum": [
                "addedAt",
                "rating",
                "releaseDate",
                "runtime",
                "title"
              ]
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "description": "Sort order",
            "required": false,
            "schema": {
              "type": "string",
              "default": "desc",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "releaseYear",
            "in": "query",
            "description": "Release year",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1901,
              "maximum": 2155
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application\/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "watchlist": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "movie": {
                            "$ref": "#/components/schemas/movie"
                          },
                          "addedAt": {
                            "$ref": "#/components/schemas/timestamp"
                          }
                        }
                      }
                    },
                    "currentPage": {
                      "type": "integer",
                      "example": 1
                    },
                    "maxPage": {
                      "type": "integer",
                      "example": 10
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      },
      "post": {
        "tags": [
          "Watchlist"
        ],
        "operationId": "addToUserWatchlist",
        "summary": "Add movies to watchlist of user",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "description": "Name of user",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application\/json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "movaryId"
                  ],
                  "properties": {
                    "movaryId": {
                      "$ref": "#/components/schemas/id"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "$ref": "#/components/responses/204"
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Watchlist"
        ],
        "operationId": "deleteFromUserWatchlist",
        "summary": "Delete movies from watchlist of user",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "description": "Name of user",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application\/json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "movaryId"
                  ],
                  "properties": {
                    "movaryId": {
                      "$ref": "#/components/schemas/id"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "$ref": "#/components/responses/204"
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      }
    },
    "\/api\/v1\/users\/{username}\/watchlist\/{movaryId}": {
      "put": {
        "tags": [
          "Watchlist"
        ],
        "operationId": "addMovieToUserWatchlist",
        "summary": "Add one movie to the user's watchlist",
        "description": "Adds the movie if absent. Repeating the request preserves the original addedAt timestamp.",
        "parameters": [
          {
            "$ref": "#/components/parameters/username"
          },
          {
            "$ref": "#/components/parameters/movaryId"
          }
        ],
        "responses": {
          "204": {
            "$ref": "#/components/responses/204"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Watchlist"
        ],
        "operationId": "deleteMovieFromUserWatchlist",
        "summary": "Remove one movie from the user's watchlist",
        "description": "Returns 204 even if the movie is not on the watchlist or does not exist.",
        "parameters": [
          {
            "$ref": "#/components/parameters/username"
          },
          {
            "$ref": "#/components/parameters/movaryId"
          }
        ],
        "responses": {
          "204": {
            "$ref": "#/components/responses/204"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      }
    },
    "\/api\/v1\/users\/{username}\/plays\/movies": {
      "get": {
        "tags": [
          "Plays"
        ],
        "operationId": "getUserPlayedMovies",
        "summary": "Get played movies of user",
        "description": "Get all played movies and their watch dates.",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "description": "Name of user",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "The search term",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Page",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Limit",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 24
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "description": "Sort by. For watchDate, ascending uses each movie's earliest play and descending uses its latest play. Same-day plays are ordered by their position.",
            "required": false,
            "schema": {
              "type": "string",
              "default": "title",
              "enum": [
                "imdbRating",
                "rating",
                "releaseDate",
                "runtime",
                "title",
                "tmdbRating",
                "watchDate"
              ]
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "description": "Sort order",
            "required": false,
            "schema": {
              "type": "string",
              "default": "asc",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "releaseYear",
            "in": "query",
            "description": "Release year",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1901,
              "maximum": 2155
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application\/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "played": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "movie": {
                            "$ref": "#/components/schemas/movie"
                          },
                          "watchDates": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "date": {
                                  "$ref": "#/components/schemas/calendarDateNullable"
                                },
                                "plays": {
                                  "$ref": "#/components/schemas/plays"
                                },
                                "comment": {
                                  "$ref": "#/components/schemas/comment"
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "currentPage": {
                      "type": "integer",
                      "example": 1
                    },
                    "maxPage": {
                      "type": "integer",
                      "example": 10
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      }
    },
    "/api/v1/movies": {
      "get": {
        "tags": ["Movies"],
        "operationId": "getMovies",
        "summary": "List movies stored in Movary",
        "description": "Lists the server-wide movie catalog, including movies that may have been added through private user activity. This does not include personal watch data. Pages beyond the last page resolve to the last page. Sorting uses Movary ID as a tie-breaker.",
        "parameters": [
          {"name": "search", "in": "query", "description": "Search localized or original title", "schema": {"type": "string"}},
          {"name": "page", "in": "query", "schema": {"type": "integer", "minimum": 1, "default": 1}},
          {"name": "limit", "in": "query", "schema": {"type": "integer", "minimum": 1, "maximum": 100, "default": 24}},
          {"name": "sortBy", "in": "query", "schema": {"type": "string", "enum": ["id", "title", "releaseDate", "runtime", "tmdbRating", "imdbRating"], "default": "id"}},
          {"name": "sortOrder", "in": "query", "schema": {"type": "string", "enum": ["asc", "desc"], "default": "asc"}},
          {"name": "releaseYear", "in": "query", "schema": {"type": "integer", "minimum": 1901, "maximum": 2155}}
        ],
        "responses": {
          "200": {
            "description": "Page of movie summaries",
            "content": {"application/json": {"schema": {"$ref": "#/components/schemas/movieList"}}}
          },
          "400": {"$ref": "#/components/responses/400"},
          "401": {"$ref": "#/components/responses/401"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      }
    },
    "/api/v1/movies/{movaryId}": {
      "get": {
        "tags": ["Movies"],
        "operationId": "getMovieDetails",
        "summary": "Get details of a movie stored in Movary",
        "description": "Returns shared movie metadata and external ratings. Personal plays, ratings, reviews, and watchlist state are not included.",
        "parameters": [{"$ref": "#/components/parameters/movaryId"}],
        "responses": {
          "200": {
            "description": "Movie details",
            "content": {"application/json": {"schema": {"$ref": "#/components/schemas/movieDetails"}}}
          },
          "401": {"$ref": "#/components/responses/401"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      }
    },
    "/api/v1/movies/{movaryId}/refresh-tmdb": {
      "post": {
        "tags": ["Movies"],
        "operationId": "refreshMovieTmdbData",
        "summary": "Refresh a movie from TMDB",
        "description": "Synchronously refreshes shared movie metadata from TMDB. Requires a personal API token.",
        "parameters": [{"$ref": "#/components/parameters/movaryId"}],
        "responses": {
          "204": {"$ref": "#/components/responses/204"},
          "401": {"$ref": "#/components/responses/401"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      }
    },
    "/api/v1/movies/{movaryId}/refresh-imdb": {
      "post": {
        "tags": ["Movies"],
        "operationId": "refreshMovieImdbRating",
        "summary": "Refresh a movie IMDb rating",
        "description": "Synchronously refreshes the shared IMDb rating from the ratings file when it has changed. A movie without an IMDb ID is left unchanged. Requires a personal API token.",
        "parameters": [{"$ref": "#/components/parameters/movaryId"}],
        "responses": {
          "204": {"$ref": "#/components/responses/204"},
          "401": {"$ref": "#/components/responses/401"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      }
    },
    "/api/v1/persons": {
      "get": {
        "tags": ["Persons"],
        "operationId": "getPersons",
        "summary": "List persons stored in Movary",
        "description": "Lists the server-wide person catalog, including persons added through private user activity. Role filters match stored movie credits, independent of a user's watch history. Pages beyond the last page resolve to the last page. Sorting uses Movary ID as a tie-breaker.",
        "parameters": [
          {"name": "search", "in": "query", "description": "Search person name", "schema": {"type": "string"}},
          {"name": "gender", "in": "query", "description": "0: unknown, 1: female, 2: male, 3: nonbinary", "schema": {"type": "integer", "enum": [0, 1, 2, 3]}},
          {"name": "role", "in": "query", "description": "Persons credited in the stored movie catalog", "schema": {"type": "string", "enum": ["actor", "director"]}},
          {"name": "page", "in": "query", "schema": {"type": "integer", "minimum": 1, "default": 1}},
          {"name": "limit", "in": "query", "schema": {"type": "integer", "minimum": 1, "maximum": 100, "default": 24}},
          {"name": "sortBy", "in": "query", "schema": {"type": "string", "enum": ["id", "name", "birthDate"], "default": "name"}},
          {"name": "sortOrder", "in": "query", "schema": {"type": "string", "enum": ["asc", "desc"], "default": "asc"}}
        ],
        "responses": {
          "200": {"description": "Page of person summaries", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/personList"}}}},
          "400": {"$ref": "#/components/responses/400"},
          "401": {"$ref": "#/components/responses/401"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      }
    },
    "/api/v1/persons/{personId}": {
      "get": {
        "tags": ["Persons"],
        "operationId": "getPersonDetails",
        "summary": "Get details of a person stored in Movary",
        "description": "Returns shared person metadata. Personal movie credits and user preferences are not included.",
        "parameters": [{"name": "personId", "in": "path", "required": true, "description": "Movary person ID", "schema": {"$ref": "#/components/schemas/id"}}],
        "responses": {
          "200": {"description": "Person details", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/personDetails"}}}},
          "401": {"$ref": "#/components/responses/401"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      }
    },
    "/api/v1/persons/{personId}/refresh-tmdb": {
      "post": {
        "tags": ["Persons"],
        "operationId": "refreshPersonTmdbData",
        "summary": "Refresh a person from TMDB",
        "description": "Synchronously refreshes shared person metadata from TMDB. Requires a personal API token.",
        "parameters": [{"name": "personId", "in": "path", "required": true, "description": "Movary person ID", "schema": {"$ref": "#/components/schemas/id"}}],
        "responses": {
          "204": {"$ref": "#/components/responses/204"},
          "401": {"$ref": "#/components/responses/401"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      }
    },
    "/api/v1/persons/{personId}/profiles": {
      "get": {
        "tags": ["Persons"],
        "operationId": "getPersonProfiles",
        "summary": "Get available profile images for a person",
        "description": "Returns the TMDB profile images for a person stored in Movary. Requires an administrator's personal API token.",
        "parameters": [{"name": "personId", "in": "path", "required": true, "description": "Movary person ID", "schema": {"$ref": "#/components/schemas/id"}}],
        "responses": {
          "200": {"description": "Available profile images and override state", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/personProfiles"}}}},
          "401": {"$ref": "#/components/responses/401"},
          "403": {"$ref": "#/components/responses/403"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      }
    },
    "/api/v1/persons/{personId}/profile": {
      "put": {
        "tags": ["Persons"],
        "operationId": "selectPersonProfile",
        "summary": "Select a profile image for a person",
        "description": "Selects an available TMDB profile image as the person's global image. Requires an administrator's personal API token.",
        "parameters": [{"name": "personId", "in": "path", "required": true, "description": "Movary person ID", "schema": {"$ref": "#/components/schemas/id"}}],
        "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "required": ["profilePath"], "properties": {"profilePath": {"type": "string", "minLength": 1}}}}}},
        "responses": {
          "204": {"$ref": "#/components/responses/204"},
          "400": {"$ref": "#/components/responses/400"},
          "401": {"$ref": "#/components/responses/401"},
          "403": {"$ref": "#/components/responses/403"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      },
      "delete": {
        "tags": ["Persons"],
        "operationId": "restoreDefaultPersonProfile",
        "summary": "Restore the default profile image for a person",
        "description": "Removes the global image selection so the person uses TMDB's current default profile image. Requires an administrator's personal API token.",
        "parameters": [{"name": "personId", "in": "path", "required": true, "description": "Movary person ID", "schema": {"$ref": "#/components/schemas/id"}}],
        "responses": {
          "204": {"$ref": "#/components/responses/204"},
          "401": {"$ref": "#/components/responses/401"},
          "403": {"$ref": "#/components/responses/403"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      }
    },
    "\/api\/v1\/movies\/{movaryId}\/posters": {
      "get": {
        "tags": [
          "Movies"
        ],
        "operationId": "getMoviePosters",
        "summary": "Get available posters for a movie",
        "description": "Gets the English-language TMDB posters available for a movie. Requires an administrator's personal API token.",
        "parameters": [
          {
            "name": "movaryId",
            "in": "path",
            "description": "Movary movie id",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application\/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "posters",
                    "hasOverride"
                  ],
                  "properties": {
                    "posters": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "path",
                          "previewUrl"
                        ],
                        "properties": {
                          "path": {
                            "type": "string",
                            "example": "\/gb7C4oRzYWXWCuZMR1cwtHa53Pz.jpg"
                          },
                          "previewUrl": {
                            "type": "string",
                            "format": "uri",
                            "example": "https:\/\/image.tmdb.org\/t\/p\/w342\/gb7C4oRzYWXWCuZMR1cwtHa53Pz.jpg"
                          }
                        }
                      }
                    },
                    "hasOverride": {
                      "type": "boolean",
                      "description": "True when an administrator selected a poster instead of using TMDB's default.",
                      "example": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      }
    },
    "\/api\/v1\/movies\/{movaryId}\/poster": {
      "put": {
        "tags": [
          "Movies"
        ],
        "operationId": "selectMoviePoster",
        "summary": "Select a poster for a movie",
        "description": "Selects one of the movie's available TMDB posters as its global poster. Requires an administrator's personal API token.",
        "parameters": [
          {
            "name": "movaryId",
            "in": "path",
            "description": "Movary movie id",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application\/json": {
              "schema": {
                "type": "object",
                "required": [
                  "posterPath"
                ],
                "properties": {
                  "posterPath": {
                    "type": "string",
                    "minLength": 1,
                    "example": "\/gb7C4oRzYWXWCuZMR1cwtHa53Pz.jpg"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "$ref": "#/components/responses/204"
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Movies"
        ],
        "operationId": "restoreDefaultMoviePoster",
        "summary": "Restore the default poster for a movie",
        "description": "Removes the global poster selection so the movie uses TMDB's current default poster. Requires an administrator's personal API token.",
        "parameters": [
          {
            "name": "movaryId",
            "in": "path",
            "description": "Movary movie id",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/id"
            }
          }
        ],
        "responses": {
          "204": {
            "$ref": "#/components/responses/204"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      }
    },
    "/api/v1/users/{username}/locations": {
      "get": {
        "tags": ["Locations"],
        "operationId": "getUserLocations",
        "summary": "List the authenticated user's locations",
        "description": "Location names are private to their owner, even when the user's movie data is shared.",
        "parameters": [{"$ref": "#/components/parameters/username"}],
        "responses": {
          "200": {
            "description": "Locations ordered by name and ID",
            "content": {"application/json": {"schema": {
              "type": "object",
              "required": ["locations"],
              "properties": {"locations": {"type": "array", "items": {"$ref": "#/components/schemas/location"}}}
            }}}
          },
          "401": {"$ref": "#/components/responses/401"},
          "403": {"$ref": "#/components/responses/403"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      },
      "post": {
        "tags": ["Locations"],
        "operationId": "createUserLocation",
        "summary": "Create a location for the authenticated user",
        "parameters": [{"$ref": "#/components/parameters/username"}],
        "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/locationInput"}}}},
        "responses": {
          "204": {"$ref": "#/components/responses/204"},
          "400": {"$ref": "#/components/responses/400"},
          "401": {"$ref": "#/components/responses/401"},
          "403": {"$ref": "#/components/responses/403"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      }
    },
    "/api/v1/users/{username}/locations/settings": {
      "get": {
        "tags": ["Locations"],
        "operationId": "getUserLocationSettings",
        "summary": "Get the authenticated user's location setting",
        "parameters": [{"$ref": "#/components/parameters/username"}],
        "responses": {
          "200": {"description": "Location feature status", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/locationSettings"}}}},
          "401": {"$ref": "#/components/responses/401"},
          "403": {"$ref": "#/components/responses/403"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      },
      "put": {
        "tags": ["Locations"],
        "operationId": "updateUserLocationSettings",
        "summary": "Enable or disable locations for the authenticated user",
        "description": "Disabling locations retains saved locations and play assignments.",
        "parameters": [{"$ref": "#/components/parameters/username"}],
        "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/locationSettings"}}}},
        "responses": {
          "204": {"$ref": "#/components/responses/204"},
          "400": {"$ref": "#/components/responses/400"},
          "401": {"$ref": "#/components/responses/401"},
          "403": {"$ref": "#/components/responses/403"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      }
    },
    "/api/v1/users/{username}/locations/{locationId}": {
      "get": {
        "tags": ["Locations"],
        "operationId": "getUserLocation",
        "summary": "Get one of the authenticated user's locations",
        "parameters": [{"$ref": "#/components/parameters/username"}, {"$ref": "#/components/parameters/locationId"}],
        "responses": {
          "200": {"description": "Location", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/location"}}}},
          "401": {"$ref": "#/components/responses/401"},
          "403": {"$ref": "#/components/responses/403"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      },
      "put": {
        "tags": ["Locations"],
        "operationId": "updateUserLocation",
        "summary": "Update one of the authenticated user's locations",
        "parameters": [{"$ref": "#/components/parameters/username"}, {"$ref": "#/components/parameters/locationId"}],
        "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/locationInput"}}}},
        "responses": {
          "204": {"$ref": "#/components/responses/204"},
          "400": {"$ref": "#/components/responses/400"},
          "401": {"$ref": "#/components/responses/401"},
          "403": {"$ref": "#/components/responses/403"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      },
      "delete": {
        "tags": ["Locations"],
        "operationId": "deleteUserLocation",
        "summary": "Delete one of the authenticated user's locations",
        "description": "Succeeds when the location is already absent. Existing play entries are retained without that location assignment.",
        "parameters": [{"$ref": "#/components/parameters/username"}, {"$ref": "#/components/parameters/locationId"}],
        "responses": {
          "204": {"$ref": "#/components/responses/204"},
          "401": {"$ref": "#/components/responses/401"},
          "403": {"$ref": "#/components/responses/403"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      }
    },
    "\/api\/v1\/users\/{username}\/movies\/{movaryId}\/rating": {
      "get": {
        "tags": ["Ratings"],
        "operationId": "getUserMovieRating",
        "summary": "Get the user's personal rating of a movie",
        "description": "Get the specified user's rating when their privacy setting permits access. Returns 404 when the movie has no rating.",
        "parameters": [
          {"$ref": "#/components/parameters/username"},
          {"$ref": "#/components/parameters/movaryId"}
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["rating"],
                  "properties": {
                    "rating": {"type": "integer", "minimum": 1, "maximum": 10}
                  }
                }
              }
            }
          },
          "401": {"$ref": "#/components/responses/401"},
          "403": {"$ref": "#/components/responses/403"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      },
      "put": {
        "tags": ["Ratings"],
        "operationId": "saveUserMovieRating",
        "summary": "Create or update the user's personal rating of a movie",
        "description": "Set the authenticated user's rating for the specified movie.",
        "parameters": [
          {"$ref": "#/components/parameters/username"},
          {"$ref": "#/components/parameters/movaryId"}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["rating"],
                "properties": {
                  "rating": {"type": "integer", "minimum": 1, "maximum": 10}
                }
              }
            }
          }
        },
        "responses": {
          "204": {"$ref": "#/components/responses/204"},
          "400": {"$ref": "#/components/responses/400"},
          "401": {"$ref": "#/components/responses/401"},
          "403": {"$ref": "#/components/responses/403"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      },
      "delete": {
        "tags": ["Ratings"],
        "operationId": "deleteUserMovieRating",
        "summary": "Delete the user's personal rating of a movie",
        "description": "Clear the authenticated user's rating. The operation succeeds when the movie exists but has no rating.",
        "parameters": [
          {"$ref": "#/components/parameters/username"},
          {"$ref": "#/components/parameters/movaryId"}
        ],
        "responses": {
          "204": {"$ref": "#/components/responses/204"},
          "401": {"$ref": "#/components/responses/401"},
          "403": {"$ref": "#/components/responses/403"},
          "404": {"$ref": "#/components/responses/404"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      }
    },
    "\/api\/v1\/users\/{username}\/movies\/{movaryId}\/review": {
      "get": {
        "tags": [
          "Reviews"
        ],
        "operationId": "getUserMovieReview",
        "summary": "Get the user's review of a movie",
        "description": "Get the specified user's review when their privacy setting permits access.",
        "parameters": [
          {
            "$ref": "#/components/parameters/username"
          },
          {
            "$ref": "#/components/parameters/movaryId"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/movieReview"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      },
      "put": {
        "tags": [
          "Reviews"
        ],
        "operationId": "saveUserMovieReview",
        "summary": "Create or update the user's review of a movie",
        "description": "Create or replace the authenticated user's review for the specified movie.",
        "parameters": [
          {
            "$ref": "#/components/parameters/username"
          },
          {
            "$ref": "#/components/parameters/movaryId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/movieReviewInput"
              }
            }
          }
        },
        "responses": {
          "204": {
            "$ref": "#/components/responses/204"
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Reviews"
        ],
        "operationId": "deleteUserMovieReview",
        "summary": "Delete the user's review of a movie",
        "description": "Delete the authenticated user's review for the specified movie. The operation succeeds when the movie exists but has no review.",
        "parameters": [
          {
            "$ref": "#/components/parameters/username"
          },
          {
            "$ref": "#/components/parameters/movaryId"
          }
        ],
        "responses": {
          "204": {
            "$ref": "#/components/responses/204"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      }
    },
    "\/api\/v1\/movies\/add": {
      "post": {
        "tags": [
          "Movies"
        ],
        "operationId": "addMovie",
        "summary": "Add movie via external provider id",
        "description": "Adds a new movie via external data provider",
        "requestBody": {
          "required": true,
          "content": {
            "application\/json": {
              "schema": {
                "type": "object",
                "required": [
                  "tmdbId"
                ],
                "properties": {
                  "tmdbId": {
                    "$ref": "#/components/schemas/id"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application\/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "movaryId": {
                      "$ref": "#/components/schemas/id"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      }
    },
    "\/api\/v1\/movies\/search": {
      "get": {
        "tags": [
          "Movies"
        ],
        "operationId": "searchMovies",
        "summary": "Search for movies remotely",
        "description": "Search remotely on tmdb for the movie with the specified search filters. Movies already existing locally will have a Movary id set.",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "description": "The search term",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Search result page",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "releaseYear",
            "in": "query",
            "description": "Filter by release year",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1901,
              "maximum": 2155,
              "example": 2012
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application\/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "$ref": "#/components/schemas/title"
                          },
                          "originalTitle": {
                            "type": "string",
                            "example": "千と千尋の神隠し"
                          },
                          "releaseDate": {
                            "$ref": "#/components/schemas/calendarDateNullable"
                          },
                          "overview": {
                            "$ref": "#/components/schemas/overview"
                          },
                          "originalLanguage": {
                            "type": "string",
                            "example": "en"
                          },
                          "tmdbPosterPath": {
                            "type": "string",
                            "example": "/gb7C4oRzYWXWCuZMR1cwtHa53Pz.jpg"
                          },
                          "ids": {
                            "type": "object",
                            "properties": {
                              "movary": {
                                "$ref": "#/components/schemas/idNullable"
                              },
                              "tmdb": {
                                "$ref": "#/components/schemas/id"
                              }
                            }
                          },
                          "isWatched": {
                            "type": "boolean",
                            "description": "True if user has watched the movie, false if not.",
                            "example": false
                          },
                          "isOnWatchlist": {
                            "type": "boolean",
                            "description": "True if user has the movie on the watchlist, false if not.",
                            "example": false
                          }
                        }
                      }
                    },
                    "currentPage": {
                      "type": "integer",
                      "example": 1
                    },
                    "maxPage": {
                      "type": "integer",
                      "example": 10
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      }
    },
    "/webhooks/plex/{token}": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "handlePlexWebhook",
        "summary": "Receive Plex webhook events",
        "description": "Endpoint to scrobble your Plex watches to Movary.",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "description": "An UUID that is generated by the user in the Plex settings.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "payload"
                ],
                "properties": {
                  "payload": {
                    "type": "string",
                    "maxLength": 262144,
                    "description": "JSON-encoded Plex webhook event"
                  }
                }
              },
              "encoding": {
                "payload": {
                  "contentType": "application/json"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "415": {
            "$ref": "#/components/responses/415"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        }
      }
    },
    "/webhooks/jellyfin/{token}": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "handleJellyfinWebhook",
        "summary": "Receive Jellyfin webhook events",
        "description": "Endpoint to scrobble your Jellyfin watches to Movary.",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "description": "An UUID that is generated by the user in the Jellyfin settings.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "NotificationType",
                  "ItemType"
                ],
                "properties": {
                  "NotificationType": {
                    "type": "string",
                    "example": "PlaybackStop"
                  },
                  "ItemType": {
                    "type": "string",
                    "example": "Movie"
                  },
                  "PlayedToCompletion": {
                    "type": "boolean"
                  },
                  "UtcTimestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "Provider_tmdb": {
                    "type": "string",
                    "pattern": "^[1-9]\\d*$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "415": {
            "$ref": "#/components/responses/415"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        }
      }
    },
    "/webhooks/emby/{token}": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "handleEmbyWebhook",
        "summary": "Receive Emby webhook events",
        "description": "Endpoint to scrobble your Emby watches to Movary.",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "description": "An UUID that is generated by the user in the Emby settings.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "data"
                ],
                "properties": {
                  "data": {
                    "type": "string",
                    "maxLength": 262144,
                    "description": "JSON-encoded Emby webhook event"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        }
      }
    },
    "/webhooks/kodi/{token}": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "handleKodiWebhook",
        "summary": "Receive Kodi webhook events",
        "description": "Endpoint to scrobble your Kodi watches to Movary.",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "description": "An UUID that is generated by the user in the Kodi settings.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "nullable": true
                  },
                  "uniqueIds": {
                    "type": "object",
                    "properties": {
                      "tmdbId": {
                        "oneOf": [
                          {
                            "type": "integer",
                            "minimum": 1
                          },
                          {
                            "type": "string",
                            "pattern": "^[1-9]\\d*$"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "413": {
            "$ref": "#/components/responses/413"
          },
          "415": {
            "$ref": "#/components/responses/415"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        }
      }
    },
    "/feeds/radarr/{token}": {
      "get": {
        "tags": [
          "Radarr"
        ],
        "operationId": "getRadarrFeed",
        "summary": "Get a user's Radarr watchlist feed",
        "description": "Returns the user's Movary watchlist in the format consumed by a Radarr import list. The feed URL grants access without a Movary login and must be treated as a credential.",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "description": "The secret feed identifier generated in the user's Radarr settings.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The current watchlist feed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "title",
                      "tmdb_id",
                      "imdb_id",
                      "added_at"
                    ],
                    "properties": {
                      "title": {
                        "$ref": "#/components/schemas/title"
                      },
                      "tmdb_id": {
                        "type": "integer",
                        "nullable": true
                      },
                      "imdb_id": {
                        "type": "string",
                        "nullable": true
                      },
                      "added_at": {
                        "$ref": "#/components/schemas/timestamp"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": []
      }
    },
    "/api/v1/me/preferences": {
      "get": {
        "tags": ["Me"],
        "operationId": "getCurrentUserPreferences",
        "summary": "Get the current user's general preferences",
        "description": "Returns the general account preferences supported by the update operation.",
        "responses": {
          "200": {"description": "General preferences", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/userPreferences"}}}},
          "401": {"$ref": "#/components/responses/401"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      },
      "patch": {
        "tags": ["Me"],
        "operationId": "updateCurrentUserPreferences",
        "summary": "Update the current user's general account preferences",
        "description": "Only supplied fields change. All fields are validated before a single database update.",
        "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/userPreferencesUpdate"}}}},
        "responses": {
          "204": {"$ref": "#/components/responses/204"},
          "400": {"$ref": "#/components/responses/400"},
          "401": {"$ref": "#/components/responses/401"},
          "500": {"$ref": "#/components/responses/500"}
        },
        "security": [{"bearerToken": []}, {"movaryToken": []}]
      }
    },
    "/api/v1/me": {
      "get": {
        "tags": [
          "Me"
        ],
        "operationId": "getCurrentUser",
        "summary": "Get current user",
        "description": "Get information about the user authenticated by the supplied personal API token.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "The name of the user"
                        },
                        "id": {
                          "type": "integer",
                          "description": "The id of the user"
                        },
                        "isAdmin": {
                          "type": "boolean",
                          "description": "True if user is an admin, false if not."
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": [
          {
            "bearerToken": []
          },
          {
            "movaryToken": []
          }
        ]
      }
    }
  },
  "components": {
    "parameters": {
      "username": {
        "name": "username",
        "in": "path",
        "description": "Name of user",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "movaryId": {
        "name": "movaryId",
        "in": "path",
        "description": "Movary movie id",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/id"
        }
      },
      "locationId": {
        "name": "locationId",
        "in": "path",
        "description": "Location id",
        "required": true,
        "schema": {"$ref": "#/components/schemas/id"}
      }
    },
    "schemas": {
      "serverEmailSettings": {
        "type": "object",
        "required": [
          "emailEnabled",
          "smtpHost",
          "smtpPort",
          "smtpFromAddress",
          "smtpEncryption",
          "smtpWithAuthentication",
          "smtpUserConfigured",
          "smtpPasswordConfigured",
          "environmentControlledFields"
        ],
        "properties": {
          "emailEnabled": {
            "type": "boolean"
          },
          "smtpHost": {
            "type": "string",
            "nullable": true
          },
          "smtpPort": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535,
            "nullable": true
          },
          "smtpFromAddress": {
            "type": "string",
            "format": "email",
            "nullable": true
          },
          "smtpEncryption": {
            "type": "string",
            "enum": [
              null,
              "ssl",
              "tls"
            ],
            "nullable": true
          },
          "smtpWithAuthentication": {
            "type": "boolean"
          },
          "smtpUserConfigured": {
            "type": "boolean"
          },
          "smtpPasswordConfigured": {
            "type": "boolean"
          },
          "environmentControlledFields": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "emailEnabled",
                "smtpHost",
                "smtpPort",
                "smtpFromAddress",
                "smtpEncryption",
                "smtpWithAuthentication",
                "smtpUser",
                "smtpPassword"
              ]
            }
          }
        }
      },
      "serverEmailSettingsUpdate": {
        "type": "object",
        "minProperties": 1,
        "additionalProperties": false,
        "properties": {
          "emailEnabled": {
            "type": "boolean"
          },
          "smtpHost": {
            "type": "string"
          },
          "smtpPort": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535
          },
          "smtpFromAddress": {
            "type": "string",
            "format": "email"
          },
          "smtpEncryption": {
            "type": "string",
            "enum": [
              "",
              "ssl",
              "tls"
            ]
          },
          "smtpWithAuthentication": {
            "type": "boolean"
          },
          "smtpUser": {
            "type": "string",
            "writeOnly": true
          },
          "smtpPassword": {
            "type": "string",
            "writeOnly": true
          }
        }
      },

        "adminUserListEntry": {
          "type": "object", "required": ["id", "name", "email", "pendingEmail", "isAdmin", "isEnabled"],
          "properties": {"id": {"type": "integer"}, "name": {"type": "string"}, "email": {"type": "string", "format": "email"}, "pendingEmail": {"type": "string", "format": "email", "nullable": true}, "isAdmin": {"type": "boolean"}, "isEnabled": {"type": "boolean"}}
        },
        "adminUser": {
          "allOf": [{"$ref": "#/components/schemas/adminUserListEntry"}, {"type": "object", "required": ["emailVerified"], "properties": {"emailVerified": {"type": "boolean"}}}]
        },
        "adminUserCreate": {
          "type": "object", "required": ["name", "email", "password", "isAdmin"], "additionalProperties": false,
          "properties": {"name": {"type": "string", "pattern": "^[a-zA-Z0-9]+$"}, "email": {"type": "string", "format": "email"}, "password": {"type": "string"}, "isAdmin": {"type": "boolean"}, "isEnabled": {"type": "boolean", "default": true}, "emailVerified": {"type": "boolean", "default": true}}
        },
        "adminUserUpdate": {
          "type": "object", "minProperties": 1, "additionalProperties": false,
          "properties": {"name": {"type": "string", "pattern": "^[a-zA-Z0-9]+$"}, "email": {"type": "string", "format": "email"}, "password": {"type": "string"}, "isAdmin": {"type": "boolean"}, "isEnabled": {"type": "boolean"}}
        },
        "visibleUsers": {
          "type": "object",
          "required": ["users"],
          "properties": {
            "users": {"type": "array", "items": {"type": "string"}}
          }
        },
        "userPreferences": {
          "type": "object",
          "required": [
            "username", "privacyLevel", "dateFormatId", "movieTitleDisplay", "country",
            "watchlistAutomaticRemovalEnabled", "displayCharacterNames", "displayTmdbRatings", "displayImdbRatings"
          ],
          "properties": {
            "username": {"type": "string", "pattern": "^[a-zA-Z0-9]+$"},
            "privacyLevel": {"type": "integer", "enum": [0, 1, 2]},
            "dateFormatId": {"type": "integer", "enum": [0, 1, 2, 3]},
            "movieTitleDisplay": {"type": "string", "enum": ["localized", "original", "both"]},
            "country": {"type": "string", "minLength": 2, "maxLength": 2, "nullable": true},
            "watchlistAutomaticRemovalEnabled": {"type": "boolean"},
            "displayCharacterNames": {"type": "boolean"},
            "displayTmdbRatings": {"type": "boolean"},
            "displayImdbRatings": {"type": "boolean"}
          }
        },
        "userPreferencesUpdate": {
          "type": "object",
          "minProperties": 1,
          "additionalProperties": false,
          "properties": {
            "username": {"type": "string", "pattern": "^[a-zA-Z0-9]+$"},
            "privacyLevel": {"type": "integer", "enum": [0, 1, 2]},
            "dateFormatId": {"type": "integer", "enum": [0, 1, 2, 3]},
            "movieTitleDisplay": {"type": "string", "enum": ["localized", "original", "both"]},
            "country": {"type": "string", "minLength": 2, "maxLength": 2, "nullable": true},
            "watchlistAutomaticRemovalEnabled": {"type": "boolean"},
            "displayCharacterNames": {"type": "boolean"},
            "displayTmdbRatings": {"type": "boolean"},
            "displayImdbRatings": {"type": "boolean"}
          }
        },
        "dashboardOverview": {
          "type": "object",
          "required": [
            "totalPlayCount",
            "uniqueMoviesCount",
            "totalHoursWatched",
            "averagePlaysPerDay",
            "averageRuntime",
            "averagePersonalRating"
          ],
          "properties": {
            "totalPlayCount": {"type": "integer", "minimum": 0},
            "uniqueMoviesCount": {"type": "integer", "minimum": 0},
            "totalHoursWatched": {"type": "integer", "minimum": 0},
            "averagePlaysPerDay": {"type": "number", "minimum": 0},
            "averageRuntime": {"type": "integer", "minimum": 0},
            "averagePersonalRating": {"type": "number", "minimum": 0}
          }
        },
        "location": {
          "type": "object",
          "required": ["id", "name", "isCinema"],
          "properties": {
            "id": {"$ref": "#/components/schemas/id"},
            "name": {"type": "string"},
            "isCinema": {"type": "boolean"}
          }
        },
        "locationInput": {
          "type": "object",
          "required": ["name", "isCinema"],
          "properties": {
            "name": {"type": "string", "minLength": 1},
            "isCinema": {"type": "boolean"}
          }
        },
        "locationSettings": {
          "type": "object",
          "required": ["locationsEnabled"],
          "properties": {"locationsEnabled": {"type": "boolean"}}
        },
        "dashboardRowsUpdate": {
          "type": "object",
          "required": ["rows"],
          "properties": {
            "rows": {
              "type": "array",
              "description": "All dashboard rows, exactly once. Use keys and zero-based positions from GET /api/v1/users/{username}/dashboard/rows.",
              "minItems": 13,
              "maxItems": 13,
              "items": {
                "type": "object",
                "required": ["key", "position", "visible", "initiallyExpanded"],
                "properties": {
                  "key": {"type": "string"},
                  "position": {"type": "integer", "minimum": 0, "maximum": 12},
                  "visible": {"type": "boolean"},
                  "initiallyExpanded": {"type": "boolean"}
                }
              }
            }
          }
        },
        "dashboardRowManifest": {
          "type": "object",
          "required": [
            "key",
            "title",
            "position",
            "visible",
            "initiallyExpanded",
            "href"
          ],
          "properties": {
            "key": {
              "type": "string"
            },
            "title": {
              "type": "string"
            },
            "position": {
              "type": "integer"
            },
            "visible": {
              "type": "boolean"
            },
            "initiallyExpanded": {
              "type": "boolean"
            },
            "href": {
              "type": "string"
            }
          }
        },
        "dashboardRowsManifest": {
          "type": "object",
          "required": [
            "rows"
          ],
          "properties": {
            "rows": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/dashboardRowManifest"
              }
            }
          }
        },
        "dashboardMovie": {
          "type": "object",
          "required": [
            "id",
            "title",
            "originalTitle",
            "releaseDate",
            "posterUrl"
          ],
          "properties": {
            "id": {
              "type": "integer"
            },
            "title": {
              "type": "string"
            },
            "originalTitle": {
              "type": "string",
              "nullable": true
            },
            "releaseDate": {
              "type": "string",
              "format": "date",
              "nullable": true
            },
            "posterUrl": {
              "type": "string"
            }
          }
        },
        "dashboardMoviePlay": {
          "type": "object",
          "required": [
            "movie",
            "watchedAt",
            "personalRating"
          ],
          "properties": {
            "movie": {
              "$ref": "#/components/schemas/dashboardMovie"
            },
            "watchedAt": {
              "type": "string",
              "format": "date"
            },
            "personalRating": {
              "type": "integer",
              "nullable": true
            }
          }
        },
        "dashboardPerson": {
          "type": "object",
          "required": [
            "id",
            "name",
            "profileUrl",
            "uniqueMovieCount"
          ],
          "properties": {
            "id": {
              "type": "integer"
            },
            "name": {
              "type": "string"
            },
            "profileUrl": {
              "type": "string"
            },
            "uniqueMovieCount": {
              "type": "integer"
            }
          }
        },
        "dashboardNamedCount": {
          "type": "object",
          "required": [
            "name",
            "count"
          ],
          "properties": {
            "name": {
              "type": "string"
            },
            "count": {
              "type": "integer"
            }
          }
        },
        "dashboardLanguage": {
          "type": "object",
          "required": [
            "name",
            "count",
            "code"
          ],
          "properties": {
            "name": {
              "type": "string"
            },
            "count": {
              "type": "integer"
            },
            "code": {
              "type": "string"
            }
          }
        },
        "dashboardCompany": {
          "type": "object",
          "required": [
            "id",
            "name",
            "count"
          ],
          "properties": {
            "id": {
              "type": "integer"
            },
            "name": {
              "type": "string"
            },
            "count": {
              "type": "integer"
            }
          }
        },
        "dashboardCountry": {
          "type": "object",
          "required": [
            "name",
            "code",
            "count"
          ],
          "properties": {
            "name": {
              "type": "string"
            },
            "code": {
              "type": "string"
            },
            "count": {
              "type": "integer"
            }
          }
        },
        "dashboardLocation": {
          "type": "object",
          "required": [
            "id",
            "name",
            "count"
          ],
          "properties": {
            "id": {
              "type": "integer"
            },
            "name": {
              "type": "string"
            },
            "count": {
              "type": "integer"
            }
          }
        },
        "dashboardRating": {
          "type": "object",
          "required": [
            "rating",
            "count"
          ],
          "properties": {
            "rating": {
              "type": "integer"
            },
            "count": {
              "type": "integer"
            }
          }
        },
        "dashboardWatchlistItem": {
          "type": "object",
          "required": [
            "movie",
            "addedAt"
          ],
          "properties": {
            "movie": {
              "$ref": "#/components/schemas/movie"
            },
            "addedAt": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$"
            }
          }
        },
        "dashboardRowLastPlays": {
          "type": "object",
          "required": [
            "key",
            "title",
            "items"
          ],
          "properties": {
            "key": {
              "type": "string",
              "enum": [
                "last-plays"
              ]
            },
            "title": {
              "type": "string"
            },
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/dashboardMoviePlay"
              }
            }
          }
        },
        "dashboardRowLastPlaysCinema": {
          "type": "object",
          "required": [
            "key",
            "title",
            "items"
          ],
          "properties": {
            "key": {
              "type": "string",
              "enum": [
                "last-plays-cinema"
              ]
            },
            "title": {
              "type": "string"
            },
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/dashboardMoviePlay"
              }
            }
          }
        },
        "dashboardRowMostWatchedActors": {
          "type": "object",
          "required": [
            "key",
            "title",
            "items"
          ],
          "properties": {
            "key": {
              "type": "string",
              "enum": [
                "most-watched-actors"
              ]
            },
            "title": {
              "type": "string"
            },
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/dashboardPerson"
              }
            }
          }
        },
        "dashboardRowMostWatchedActresses": {
          "type": "object",
          "required": [
            "key",
            "title",
            "items"
          ],
          "properties": {
            "key": {
              "type": "string",
              "enum": [
                "most-watched-actresses"
              ]
            },
            "title": {
              "type": "string"
            },
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/dashboardPerson"
              }
            }
          }
        },
        "dashboardRowMostWatchedDirectors": {
          "type": "object",
          "required": [
            "key",
            "title",
            "items"
          ],
          "properties": {
            "key": {
              "type": "string",
              "enum": [
                "most-watched-directors"
              ]
            },
            "title": {
              "type": "string"
            },
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/dashboardPerson"
              }
            }
          }
        },
        "dashboardRowMostWatchedGenres": {
          "type": "object",
          "required": [
            "key",
            "title",
            "items"
          ],
          "properties": {
            "key": {
              "type": "string",
              "enum": [
                "most-watched-genres"
              ]
            },
            "title": {
              "type": "string"
            },
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/dashboardNamedCount"
              }
            }
          }
        },
        "dashboardRowMostWatchedLanguages": {
          "type": "object",
          "required": [
            "key",
            "title",
            "items"
          ],
          "properties": {
            "key": {
              "type": "string",
              "enum": [
                "most-watched-languages"
              ]
            },
            "title": {
              "type": "string"
            },
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/dashboardLanguage"
              }
            }
          }
        },
        "dashboardRowMostWatchedProductionCompanies": {
          "type": "object",
          "required": [
            "key",
            "title",
            "items"
          ],
          "properties": {
            "key": {
              "type": "string",
              "enum": [
                "most-watched-production-companies"
              ]
            },
            "title": {
              "type": "string"
            },
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/dashboardCompany"
              }
            }
          }
        },
        "dashboardRowMostWatchedProductionCountries": {
          "type": "object",
          "required": [
            "key",
            "title",
            "items"
          ],
          "properties": {
            "key": {
              "type": "string",
              "enum": [
                "most-watched-production-countries"
              ]
            },
            "title": {
              "type": "string"
            },
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/dashboardCountry"
              }
            }
          }
        },
        "dashboardRowMostWatchedReleaseYears": {
          "type": "object",
          "required": [
            "key",
            "title",
            "items"
          ],
          "properties": {
            "key": {
              "type": "string",
              "enum": [
                "most-watched-release-years"
              ]
            },
            "title": {
              "type": "string"
            },
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/dashboardNamedCount"
              }
            }
          }
        },
        "dashboardRowLatestWatchlist": {
          "type": "object",
          "required": [
            "key",
            "title",
            "items"
          ],
          "properties": {
            "key": {
              "type": "string",
              "enum": [
                "latest-watchlist"
              ]
            },
            "title": {
              "type": "string"
            },
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/dashboardWatchlistItem"
              }
            }
          }
        },
        "dashboardRowTopLocations": {
          "type": "object",
          "required": [
            "key",
            "title",
            "items"
          ],
          "properties": {
            "key": {
              "type": "string",
              "enum": [
                "top-locations"
              ]
            },
            "title": {
              "type": "string"
            },
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/dashboardLocation"
              }
            }
          }
        },
        "dashboardRowPersonalRatingDistribution": {
          "type": "object",
          "required": [
            "key",
            "title",
            "items"
          ],
          "properties": {
            "key": {
              "type": "string",
              "enum": [
                "personal-rating-distribution"
              ]
            },
            "title": {
              "type": "string"
            },
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/dashboardRating"
              }
            }
          }
        },
        "dashboardRowResponse": {
          "oneOf": [
            {
              "$ref": "#/components/schemas/dashboardRowLastPlays"
            },
            {
              "$ref": "#/components/schemas/dashboardRowLastPlaysCinema"
            },
            {
              "$ref": "#/components/schemas/dashboardRowMostWatchedActors"
            },
            {
              "$ref": "#/components/schemas/dashboardRowMostWatchedActresses"
            },
            {
              "$ref": "#/components/schemas/dashboardRowMostWatchedDirectors"
            },
            {
              "$ref": "#/components/schemas/dashboardRowMostWatchedGenres"
            },
            {
              "$ref": "#/components/schemas/dashboardRowMostWatchedLanguages"
            },
            {
              "$ref": "#/components/schemas/dashboardRowMostWatchedProductionCompanies"
            },
            {
              "$ref": "#/components/schemas/dashboardRowMostWatchedProductionCountries"
            },
            {
              "$ref": "#/components/schemas/dashboardRowMostWatchedReleaseYears"
            },
            {
              "$ref": "#/components/schemas/dashboardRowLatestWatchlist"
            },
            {
              "$ref": "#/components/schemas/dashboardRowTopLocations"
            },
            {
              "$ref": "#/components/schemas/dashboardRowPersonalRatingDistribution"
            }
          ],
          "discriminator": {
            "propertyName": "key",
            "mapping": {
              "last-plays": "#/components/schemas/dashboardRowLastPlays",
              "last-plays-cinema": "#/components/schemas/dashboardRowLastPlaysCinema",
              "most-watched-actors": "#/components/schemas/dashboardRowMostWatchedActors",
              "most-watched-actresses": "#/components/schemas/dashboardRowMostWatchedActresses",
              "most-watched-directors": "#/components/schemas/dashboardRowMostWatchedDirectors",
              "most-watched-genres": "#/components/schemas/dashboardRowMostWatchedGenres",
              "most-watched-languages": "#/components/schemas/dashboardRowMostWatchedLanguages",
              "most-watched-production-companies": "#/components/schemas/dashboardRowMostWatchedProductionCompanies",
              "most-watched-production-countries": "#/components/schemas/dashboardRowMostWatchedProductionCountries",
              "most-watched-release-years": "#/components/schemas/dashboardRowMostWatchedReleaseYears",
              "latest-watchlist": "#/components/schemas/dashboardRowLatestWatchlist",
              "top-locations": "#/components/schemas/dashboardRowTopLocations",
              "personal-rating-distribution": "#/components/schemas/dashboardRowPersonalRatingDistribution"
            }
          }
        },
      "playCreate": {
        "type": "object",
        "required": [
          "movaryId",
          "watchedAt"
        ],
        "properties": {
          "movaryId": {
            "$ref": "#\/components\/schemas\/id"
          },
          "watchedAt": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "position": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32767,
            "nullable": true
          },
          "comment": {
            "type": "string",
            "nullable": true
          },
          "locationId": {
            "type": "integer",
            "minimum": 1,
            "nullable": true
          }
        }
      },
      "play": {
        "type": "object",
        "required": [
          "id",
          "movie",
          "watchedAt",
          "position",
          "comment",
          "locationId"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 1,
            "description": "Stable local play ID"
          },
          "movie": {
            "$ref": "#\/components\/schemas\/movie"
          },
          "watchedAt": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "position": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32767
          },
          "comment": {
            "type": "string",
            "nullable": true
          },
          "locationId": {
            "type": "integer",
            "minimum": 1,
            "nullable": true
          }
        }
      },
      "playUpdate": {
        "type": "object",
        "required": [
          "watchedAt",
          "position",
          "comment",
          "locationId"
        ],
        "properties": {
          "watchedAt": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "position": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32767
          },
          "comment": {
            "type": "string",
            "nullable": true
          },
          "locationId": {
            "type": "integer",
            "minimum": 1,
            "nullable": true
          }
        }
      },
      "movieReviewInput": {
        "type": "object",
        "required": [
          "review"
        ],
        "properties": {
          "review": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000,
            "pattern": "\\S",
            "example": "A thoughtful review of the movie."
          },
          "containsSpoilers": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "movieReview": {
        "allOf": [
          {
            "$ref": "#/components/schemas/movieReviewInput"
          },
          {
            "type": "object",
            "required": [
              "containsSpoilers",
              "createdAt",
              "updatedAt"
            ],
            "properties": {
              "createdAt": {
                "$ref": "#/components/schemas/timestamp"
              },
              "updatedAt": {
                "$ref": "#/components/schemas/timestampNullable"
              }
            }
          }
        ]
      },
      "movieList": {
        "type": "object",
        "required": ["movies", "currentPage", "maxPage", "totalCount"],
        "properties": {
          "movies": {"type": "array", "items": {"$ref": "#/components/schemas/movieSummary"}},
          "currentPage": {"type": "integer", "minimum": 1},
          "maxPage": {"type": "integer", "minimum": 1},
          "totalCount": {"type": "integer", "minimum": 0}
        }
      },
      "personList": {
        "type": "object",
        "required": ["persons", "currentPage", "maxPage", "totalCount"],
        "properties": {
          "persons": {"type": "array", "items": {"$ref": "#/components/schemas/personSummary"}},
          "currentPage": {"type": "integer", "minimum": 1},
          "maxPage": {"type": "integer", "minimum": 1},
          "totalCount": {"type": "integer", "minimum": 0}
        }
      },
      "personSummary": {
        "type": "object",
        "required": ["id", "tmdbId", "name", "gender", "knownForDepartment", "birthDate", "posterUrl"],
        "properties": {
          "id": {"$ref": "#/components/schemas/id"},
          "tmdbId": {"$ref": "#/components/schemas/id"},
          "name": {"type": "string"},
          "gender": {"type": "integer", "enum": [0, 1, 2, 3]},
          "knownForDepartment": {"type": "string", "nullable": true},
          "birthDate": {"$ref": "#/components/schemas/calendarDateNullable"},
          "posterUrl": {"type": "string"}
        }
      },
      "personDetails": {
        "type": "object",
        "required": ["id", "tmdbId", "imdbId", "name", "gender", "knownForDepartment", "biography", "birthDate", "deathDate", "placeOfBirth", "posterUrl"],
        "properties": {
          "id": {"$ref": "#/components/schemas/id"},
          "tmdbId": {"$ref": "#/components/schemas/id"},
          "imdbId": {"type": "string", "nullable": true},
          "name": {"type": "string"},
          "gender": {"type": "integer", "enum": [0, 1, 2, 3]},
          "knownForDepartment": {"type": "string", "nullable": true},
          "biography": {"type": "string", "nullable": true},
          "birthDate": {"$ref": "#/components/schemas/calendarDateNullable"},
          "deathDate": {"$ref": "#/components/schemas/calendarDateNullable"},
          "placeOfBirth": {"type": "string", "nullable": true},
          "posterUrl": {"type": "string", "description": "Display URL, including the configured poster override or a placeholder"}
        }
      },
      "personProfiles": {
        "type": "object",
        "required": ["profiles", "hasOverride"],
        "properties": {
          "profiles": {"type": "array", "items": {"type": "object", "required": ["path", "previewUrl"], "properties": {"path": {"type": "string"}, "previewUrl": {"type": "string", "format": "uri"}}}},
          "hasOverride": {"type": "boolean", "description": "True when an administrator selected a profile image instead of using TMDB's default."}
        }
      },
      "movieSummary": {
        "type": "object",
        "required": ["id", "tmdbId", "title", "releaseDate", "posterUrl"],
        "properties": {
          "id": {"$ref": "#/components/schemas/id"},
          "tmdbId": {"$ref": "#/components/schemas/id"},
          "title": {"$ref": "#/components/schemas/title"},
          "releaseDate": {"$ref": "#/components/schemas/calendarDateNullable"},
          "posterUrl": {"type": "string"}
        }
      },
      "movieDetails": {
        "type": "object",
        "required": [
          "id", "tmdbId", "traktId", "imdbId", "title", "originalTitle", "releaseDate",
          "tagline", "overview", "originalLanguage", "runtime", "posterUrl",
          "tmdbRatingAverage", "tmdbRatingVoteCount", "imdbRatingAverage", "imdbRatingVoteCount"
        ],
        "properties": {
          "id": {"$ref": "#/components/schemas/id"},
          "tmdbId": {"$ref": "#/components/schemas/id"},
          "traktId": {"$ref": "#/components/schemas/idNullable"},
          "imdbId": {"type": "string", "nullable": true},
          "title": {"$ref": "#/components/schemas/title"},
          "originalTitle": {"type": "string", "nullable": true},
          "releaseDate": {"$ref": "#/components/schemas/calendarDateNullable"},
          "tagline": {"type": "string", "nullable": true},
          "overview": {"$ref": "#/components/schemas/overview"},
          "originalLanguage": {"type": "string", "nullable": true, "description": "ISO 639-1 language code"},
          "runtime": {"type": "integer", "nullable": true, "description": "Minutes"},
          "posterUrl": {"type": "string", "description": "Display URL, including the configured poster override or a placeholder"},
          "tmdbRatingAverage": {"type": "number", "nullable": true},
          "tmdbRatingVoteCount": {"type": "integer", "nullable": true},
          "imdbRatingAverage": {"type": "number", "nullable": true},
          "imdbRatingVoteCount": {"type": "integer", "nullable": true}
        }
      },
      "movie": {
        "type": "object",
        "properties": {
          "title": {
            "$ref": "#/components/schemas/title"
          },
          "originalTitle": {
            "type": "string",
            "nullable": true,
            "example": "千と千尋の神隠し"
          },
          "releaseDate": {
            "$ref": "#/components/schemas/calendarDateNullable"
          },
          "tagline": {
            "type": "string",
            "nullable": true
          },
          "overview": {
            "$ref": "#/components/schemas/overview"
          },
          "originalLanguage": {
            "type": "string",
            "nullable": true
          },
          "runtime": {
            "type": "integer",
            "nullable": true
          },
          "posterPath": {
            "type": "string",
            "nullable": true
          },
          "ids": {
            "type": "object",
            "properties": {
              "movary": {
                "$ref": "#/components/schemas/id"
              },
              "tmdb": {
                "$ref": "#/components/schemas/idNullable"
              },
              "trakt": {
                "$ref": "#/components/schemas/idNullable"
              },
              "imdb": {
                "type": "string",
                "nullable": true
              },
              "letterboxd": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "userRating": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 10
          },
          "externalRatings": {
            "type": "object",
            "properties": {
              "tmdb": {
                "type": "object",
                "properties": {
                  "average": {
                    "type": "number"
                  },
                  "count": {
                    "type": "integer"
                  }
                }
              },
              "imdb": {
                "type": "object",
                "properties": {
                  "average": {
                    "type": "number"
                  },
                  "count": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "updatedAt": {
            "$ref": "#/components/schemas/timestampNullable"
          },
          "createdAt": {
            "$ref": "#/components/schemas/timestamp"
          }
        }
      },
      "id": {
        "type": "integer",
        "minimum": 1,
        "example": 42
      },
      "idNullable": {
        "type": "integer",
        "example": 42,
        "nullable": true
      },
      "plays": {
        "type": "integer",
        "minimum": 1,
        "maximum": 32767,
        "example": 1
      },
      "playsOptional": {
        "type": "integer",
        "minimum": 1,
        "maximum": 32767,
        "example": 1,
        "nullable": true,
        "default": 1
      },
      "title": {
        "type": "string",
        "example": "Matrix"
      },
      "overview": {
        "type": "string",
        "example": "Lorem ipsum",
        "nullable": true
      },
      "comment": {
        "type": "string",
        "example": "This is a comment",
        "nullable": true
      },
      "commentOptional": {
        "type": "string",
        "example": "This is a comment",
        "nullable": true,
        "default": null
      },
      "position": {
        "type": "integer",
        "minimum": 1,
        "maximum": 32767,
        "example": 1,
        "nullable": false
      },
      "positionNullable": {
        "type": "integer",
        "minimum": 1,
        "maximum": 32767,
        "example": 1,
        "nullable": true
      },
      "positionOptional": {
        "type": "integer",
        "minimum": 1,
        "maximum": 32767,
        "example": 1,
        "nullable": true,
        "default": 1
      },
      "calendarDate": {
        "type": "string",
        "format": "date",
        "example": "2023-07-02"
      },
      "calendarDateNullable": {
        "type": "string",
        "format": "date",
        "nullable": true,
        "example": "2023-07-02"
      },
      "timestamp": {
        "type": "string",
        "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$",
        "example": "2023-07-02 12:34:56"
      },
      "timestampNullable": {
        "type": "string",
        "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$",
        "nullable": true,
        "example": "2023-07-02 12:34:56"
      }
    },
    "responses": {
      "204": {
        "description": "Successful operation, response has no content"
      },
      "400": {
        "description": "The request payload or header are not correct",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string",
                  "description": "The error type",
                  "example": "ErrorType"
                },
                "message": {
                  "type": "string",
                  "description": "The error message",
                  "example": "This is the error message"
                }
              }
            }
          }
        }
      },
      "401": {
        "description": "A personal API credential is missing or invalid",
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string",
              "example": "Bearer"
            }
          }
        }
      },
      "403": {
        "description": "The authenticated user is not authorized to access the resource"
      },
      "404": {
        "description": "The resource was not found"
      },
      "413": {
        "description": "The webhook JSON payload exceeds 262144 bytes",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/responses/400/content/application~1json/schema"
            }
          }
        }
      },
      "415": {
        "description": "The webhook request uses an unsupported media type",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/responses/400/content/application~1json/schema"
            }
          }
        }
      },
      "500": {
        "description": "An unexpected server error occurred",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "error",
                "message"
              ],
              "properties": {
                "error": {
                  "type": "string",
                  "example": "InternalServerError"
                },
                "message": {
                  "type": "string",
                  "example": "The request could not be processed."
                }
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "bearerToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "Personal API token supplied as an Authorization Bearer credential."
      },
      "movaryToken": {
        "type": "apiKey",
        "name": "X-Movary-Token",
        "in": "header",
        "description": "Personal API token supplied in Movary's custom header. This remains supported for reverse proxies that use Authorization for Basic authentication."
      }
    }
  }
}
