{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://isuretype.pendraco.com/samples/spec.json",
  "title": "iSureType file formats",
  "description": "Editable JSON shape of the three iSureType sharing payloads. Every `.isuretype` file opens in the app via the Import/Export tab (AirDrop, Files.app, Safari download, Mail). Files are pretty-printed with sorted keys so they round-trip cleanly through hand-editing and version control.",
  "oneOf": [
    { "$ref": "#/$defs/profile" },
    { "$ref": "#/$defs/phrases" },
    { "$ref": "#/$defs/words" }
  ],
  "$defs": {
    "profile": {
      "type": "object",
      "required": ["format", "version", "name", "profile"],
      "properties": {
        "format":  { "const": "iSureType.profile" },
        "version": { "const": 1 },
        "name":    { "type": "string", "description": "Display name shown in the Profiles list." },
        "profile": { "$ref": "#/$defs/profileSettings" }
      },
      "additionalProperties": false
    },
    "phrases": {
      "type": "object",
      "required": ["format", "version", "category", "phrases"],
      "properties": {
        "format":   { "const": "iSureType.phrases" },
        "version":  { "const": 1 },
        "category": { "type": "string", "description": "Smart Phrases category to merge into — created on import if absent." },
        "phrases":  { "type": "array", "items": { "type": "string" } }
      },
      "additionalProperties": false
    },
    "words": {
      "type": "object",
      "required": ["format", "version", "category", "words"],
      "properties": {
        "format":   { "const": "iSureType.words" },
        "version":  { "const": 1 },
        "category": { "type": "string", "description": "My Words category to merge into — created on import if absent." },
        "words":    { "type": "array", "items": { "type": "string" } }
      },
      "additionalProperties": false
    },
    "profileSettings": {
      "type": "object",
      "description": "Every kb_* preference the host app captures. Matches SharedSettings.ProfileSettings on the iOS side.",
      "properties": {
        "autoCapitalize":          { "type": "boolean" },
        "autoCommit":              { "type": "boolean", "description": "Auto-commit top candidate on space." },
        "autoSpace":               { "type": "boolean" },
        "clickIntensity":          { "type": "integer", "minimum": 0, "maximum": 1, "description": "0 = off, 1 = on. iOS only exposes a single key-click volume to third-party keyboards." },
        "colorSchemeMode":         { "type": "integer", "enum": [0, 1, 2], "description": "0 follow system, 1 light, 2 dark." },
        "doubleTapDelayMs":        { "type": "integer", "minimum": 150, "maximum": 1500 },
        "doubleTapPeriod":         { "type": "boolean" },
        "dominantHand":            { "type": "integer", "enum": [0, 1], "description": "0 left, 1 right — mirrors the callout position and chin-bar affordances." },
        "emojiSuggestionCount":    { "type": "integer", "minimum": 1, "maximum": 5 },
        "emojiSuggestionsEnabled": { "type": "boolean" },
        "inlinePredictionEnabled": { "type": "boolean" },
        "keyAnimations":           { "type": "boolean" },
        "keyCharContrast":         { "type": "number", "minimum": 0.0, "maximum": 1.0 },
        "keyboardScale":           { "type": "number", "minimum": 0.75, "maximum": 1.25 },
        "keySecondaryColor":       { "type": "integer", "description": "ARGB; 0 = auto / match primary." },
        "phraseAccentColor":       { "type": "integer", "description": "ARGB as unsigned 32-bit int (e.g. 4279913215 = 0xFF007AFF blue)." },
        "punctLongPressEnabled":   { "type": "boolean" },
        "showSuggestions":         { "type": "boolean" },
        "strongCount":             { "type": "integer", "minimum": 1, "maximum": 5 },
        "suggestionFocalPos":      { "type": "number", "minimum": 0.0, "maximum": 1.0 },
        "t9CalloutAngle":          { "type": "number", "minimum": -1.2, "maximum": 1.2, "description": "Radians from the key's up axis, rotating AWAY from the thumb." },
        "t9CalloutDistance":       { "type": "number", "minimum": 30, "maximum": 140, "description": "Points from key center to callout center." },
        "t9LongPressEnabled":      { "type": "boolean" },
        "t9LongPressWindowMs":     { "type": "integer", "minimum": 30, "maximum": 500 },
        "tabOrder":                { "type": ["array", "null"], "items": { "type": "string", "enum": ["general", "words", "phrases", "autocorrect", "profiles", "clipboard", "image", "importExport", "help"] }, "description": "Optional — if omitted, the user's current tab order is kept." }
      },
      "additionalProperties": false
    }
  }
}
