{
  "$id": "UserSettings.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "Id.json"
    },
    "version": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991,
      "description": "Raised by the server on every change; clients send the version they last saw so conflicts can be spotted."
    },
    "updatedAt": {
      "$ref": "Timestamp.json"
    },
    "deletedAt": {
      "description": "Set when the record is deleted; deleted records are kept so other devices learn of the deletion.",
      "$ref": "Timestamp.json"
    },
    "misconductScheme": {
      "description": "The default scheme for cards; a competition can override it.",
      "$ref": "SchemeId.json"
    },
    "currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$",
      "description": "Default currency for fees."
    },
    "distanceUnit": {
      "$ref": "DistanceUnit.json"
    },
    "temperatureUnit": {
      "$ref": "TemperatureUnit.json"
    },
    "maxHeartRate": {
      "description": "Beats a minute, for heart-rate zones (TRK-4).",
      "type": "integer",
      "minimum": 100,
      "maximum": 240
    },
    "sprintKph": {
      "description": "Where sprinting starts, in km/h, for the speed bands and sprints (TRK-11); the other bands scale with it. 21 when not set.",
      "type": "number",
      "minimum": 15,
      "maximum": 35
    },
    "calendarArriveMin": {
      "description": "Minutes before kickoff the calendar feed's events start, for travel and warming up (CAL-3); 0 starts them at kickoff. 30 when not set.",
      "type": "integer",
      "minimum": 0,
      "maximum": 180
    },
    "calendarReminderMin": {
      "description": "Before several reminders (CAL-3): minutes before kickoff for the calendar feed's one reminder; 0 for none. Used only when none of calendarReminders, calendarDayBefore and calendarDayOf is set; 60 when nothing is.",
      "type": "integer",
      "minimum": 0,
      "maximum": 2880
    },
    "calendarReminders": {
      "description": "The calendar feed's reminders, in minutes before kickoff (CAL-3): 15-minute steps up to 3 hours.",
      "maxItems": 12,
      "type": "array",
      "items": {
        "type": "integer",
        "minimum": 15,
        "maximum": 180
      }
    },
    "calendarDayBefore": {
      "description": "A reminder the day before a match at this time (HH:MM, in the match's time zone); none when not set.",
      "type": "string",
      "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
    },
    "watchScreen": {
      "description": "Missing until it's first chosen: watches then keep Default, or their own choice.",
      "$ref": "WatchScreen.json"
    },
    "calendarDayOf": {
      "description": "A reminder on the day of a match at this time (HH:MM, in the match's time zone), when that's before the event starts; none when not set.",
      "type": "string",
      "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
    }
  },
  "required": [
    "id",
    "version",
    "updatedAt",
    "misconductScheme",
    "currency",
    "distanceUnit",
    "temperatureUnit"
  ],
  "additionalProperties": false,
  "description": "The user's preferences; one per user, first set from the browser's language when the account is created."
}
