{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nopaque-co-uk/json-schema/nopaque-co-uk-update-user-preferences-request-schema.json",
  "title": "UpdateUserPreferencesRequest",
  "description": "PATCH body for `PATCH /user/preferences`. All fields optional — only fields\npresent in the body are updated.\n\nSending `dashboardLayout: null` resets the user to the frontend default.\nA malformed layout is rejected with 400 rather than partially stored.\n",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nopaque-co-uk-users-api-openapi.yml#/components/schemas/UpdateUserPreferencesRequest",
  "type": "object",
  "properties": {
    "dashboardLayout": {
      "description": "Replacement dashboard arrangement, or `null` to reset to the default.\nRejected with 400 if module ids are duplicated or malformed, a module\nextends past column 12, more than 60 modules are sent, or `savedAt` is\nnot an ISO date.\n",
      "oneOf": [
        {
          "$ref": "#/$defs/DashboardLayoutPreference"
        },
        {
          "type": "null"
        }
      ]
    },
    "themePreference": {
      "type": "string",
      "enum": [
        "light",
        "dark",
        "brand",
        "system"
      ],
      "description": "New theme preference."
    }
  },
  "$defs": {
    "DashboardLayoutModule": {
      "type": "object",
      "description": "One module placed on the configurable platform dashboard. Coordinates are\nin grid units on a fixed 12-column grid, never pixels.\n",
      "required": [
        "id",
        "x",
        "y",
        "w",
        "h"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{1,64}$",
          "description": "Module id from the frontend module registry."
        },
        "x": {
          "type": "integer",
          "minimum": 0,
          "maximum": 11,
          "description": "Left edge, in columns. `x + w` must not exceed 12."
        },
        "y": {
          "type": "integer",
          "minimum": 0,
          "maximum": 400,
          "description": "Top edge, in rows."
        },
        "w": {
          "type": "integer",
          "minimum": 1,
          "maximum": 12,
          "description": "Width in columns."
        },
        "h": {
          "type": "integer",
          "minimum": 1,
          "maximum": 400,
          "description": "Height in rows."
        }
      }
    },
    "DashboardLayoutPreference": {
      "type": "object",
      "description": "A user's saved dashboard arrangement.\n\n`savedAt` records when the user last configured their dashboard. The\nfrontend compares it against the date each module became available — the\nlater of when the module shipped and when this workspace first had data\nfor it — to decide what is new to that user. That is why no per-module\ndismissal state is stored: a date cannot get permanently stuck the way a\ndismissal list can.\n\nAbsent for any user who has never configured a dashboard. The frontend\nowns the default and deliberately writes nothing until the user edits,\nso there is no seeding job and no backfill.\n",
      "required": [
        "modules",
        "savedAt"
      ],
      "properties": {
        "modules": {
          "type": "array",
          "maxItems": 60,
          "description": "Placed modules. Ids must be unique. An empty array is valid — a user\nmay strip their dashboard bare.\n",
          "items": {
            "$ref": "#/$defs/DashboardLayoutModule"
          }
        },
        "savedAt": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
          "description": "ISO date (YYYY-MM-DD) the user last configured the dashboard."
        }
      }
    }
  }
}