{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "settings": {
      "type": "object",
      "properties": {
        "contact": {
          "type": "object",
          "properties": {
            "firstName": {
              "description": "First name. Gives the first avatar initial when its first character is a letter.",
              "type": "string",
              "minLength": 1
            },
            "lastName": {
              "description": "Last name. Gives the second avatar initial when its first character is a letter.",
              "type": "string",
              "minLength": 1
            },
            "nickname": {
              "description": "Nickname. When set, the name pill shows it instead of the names.",
              "type": "string",
              "minLength": 1
            },
            "phone": {
              "description": "Phone number as shown on the phone. The name pill shows it only when no name or nickname is set.",
              "type": "string",
              "minLength": 1
            },
            "photo": {
              "description": "Contact photo: a path relative to the input JSON file, a data: URI, or an http(s) URL. Replaces the initials or silhouette.",
              "type": "string",
              "minLength": 1
            }
          },
          "additionalProperties": false,
          "description": "The contact at the start of the thread, like an iOS contact card. At least one of firstName, lastName, nickname or phone must be set. Avatar: the photo if set; else one upper-case initial from each of firstName and lastName whose first character is a letter (any script); else the grey silhouette. Name pill: the first of nickname, firstName, lastName, phone (a first and a last name show the first name only)."
        },
        "background": {
          "default": {
            "kind": "none"
          },
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "none"
                }
              },
              "required": [
                "kind"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "pattern"
                },
                "text": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "text"
              ],
              "additionalProperties": false
            }
          ]
        },
        "fps": {
          "default": 30,
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "startAt": {
          "type": "string",
          "minLength": 1
        },
        "realism": {
          "default": true,
          "type": "boolean"
        },
        "readReceipts": {
          "default": true,
          "type": "boolean"
        },
        "battery": {
          "default": {
            "startLevel": 100,
            "drainPerHour": 5
          },
          "type": "object",
          "properties": {
            "startLevel": {
              "default": 100,
              "type": "number",
              "minimum": 0,
              "maximum": 100
            },
            "drainPerHour": {
              "default": 5,
              "type": "number",
              "minimum": 0
            }
          },
          "additionalProperties": false
        },
        "autoStatus": {
          "default": {
            "deliveredAfter": "0s",
            "deliveredJitter": "0s",
            "readAfter": null,
            "readJitter": "0s",
            "implicitReadBeforeReceive": true
          },
          "type": "object",
          "properties": {
            "deliveredAfter": {
              "default": "0s",
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1
                },
                {
                  "type": "null"
                }
              ]
            },
            "deliveredJitter": {
              "default": "0s",
              "type": "string",
              "minLength": 1
            },
            "readAfter": {
              "default": null,
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1
                },
                {
                  "type": "null"
                }
              ]
            },
            "readJitter": {
              "default": "0s",
              "type": "string",
              "minLength": 1
            },
            "implicitReadBeforeReceive": {
              "default": true,
              "type": "boolean"
            }
          },
          "additionalProperties": false
        },
        "signalBars": {
          "type": "number"
        },
        "wifiBars": {
          "type": "number"
        },
        "batteryLevel": {
          "type": "number"
        },
        "lowPowerMode": {
          "type": "boolean"
        },
        "time": {
          "type": "string"
        },
        "unreadCount": {
          "default": 0,
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "clock": {
          "default": "24h",
          "type": "string",
          "enum": [
            "24h",
            "12h"
          ]
        }
      },
      "required": [
        "contact"
      ],
      "additionalProperties": false
    },
    "events": {
      "minItems": 1,
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "send"
              },
              "content": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "text"
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "kind",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "image"
                      },
                      "src": {
                        "type": "string",
                        "minLength": 1
                      },
                      "width": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "height": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "src"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "at": {
                "type": "string",
                "minLength": 1
              },
              "tail": {
                "type": "boolean"
              },
              "status": {
                "type": "string",
                "const": "none"
              }
            },
            "required": [
              "type",
              "content"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "receive"
              },
              "content": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "text"
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "kind",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "image"
                      },
                      "src": {
                        "type": "string",
                        "minLength": 1
                      },
                      "width": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "height": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "src"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "at": {
                "type": "string",
                "minLength": 1
              },
              "tail": {
                "type": "boolean"
              }
            },
            "required": [
              "type",
              "content"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "read"
              },
              "at": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "type",
              "at"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "typing"
              },
              "at": {
                "type": "string",
                "minLength": 1
              },
              "duration": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "typing-stop"
              },
              "at": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "type",
              "at"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "compose"
              },
              "at": {
                "type": "string",
                "minLength": 1
              },
              "actions": {
                "minItems": 1,
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "type"
                        },
                        "text": {
                          "type": "string"
                        },
                        "speed": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "slow"
                            },
                            {
                              "type": "string",
                              "const": "medium"
                            },
                            {
                              "type": "string",
                              "const": "fast"
                            }
                          ]
                        },
                        "cps": {
                          "type": "number",
                          "exclusiveMinimum": 0
                        }
                      },
                      "required": [
                        "type",
                        "text"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "delete"
                        },
                        "count": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "speed": {
                          "anyOf": [
                            {
                              "type": "string",
                              "const": "slow"
                            },
                            {
                              "type": "string",
                              "const": "medium"
                            },
                            {
                              "type": "string",
                              "const": "fast"
                            }
                          ]
                        },
                        "cps": {
                          "type": "number",
                          "exclusiveMinimum": 0
                        }
                      },
                      "required": [
                        "type",
                        "count"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "delete-all"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "pause"
                        },
                        "duration": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "type",
                        "duration"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "send"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            },
            "required": [
              "type",
              "actions"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "divider"
              },
              "at": {
                "type": "string",
                "minLength": 1
              },
              "text": {
                "type": "string"
              },
              "auto": {
                "type": "boolean"
              }
            },
            "required": [
              "type",
              "at"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "battery"
              },
              "at": {
                "type": "string",
                "minLength": 1
              },
              "level": {
                "type": "number",
                "description": "Battery level at this moment: a whole number 0..100 under realism."
              }
            },
            "required": [
              "type",
              "level"
            ],
            "additionalProperties": false,
            "description": "Sets the status-bar battery level at this moment. Renders nothing in the thread. Drain or charging continues from the new level. Without at, an item takes the moment of the previous event (+0s, not +1s). A relative at on an item counts from the previous event or item; a relative at on a message still counts from the previous message."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "charger"
              },
              "at": {
                "type": "string",
                "minLength": 1
              },
              "connected": {
                "type": "boolean",
                "description": "true plugs the phone in; false unplugs it."
              },
              "ratePerHour": {
                "description": "Charging speed in percent per hour, greater than 0. Omitted: 50 when plugging in, the current rate when already plugged in. Only allowed when connected is true.",
                "type": "number"
              }
            },
            "required": [
              "type",
              "connected"
            ],
            "additionalProperties": false,
            "description": "Plugs the phone in or unplugs it. Renders nothing in the thread. Plugged in, the level rises and stops at 100; unplugged, it drains at settings.battery.drainPerHour and stops at 0. A second connected:true while plugged in only changes the rate, and keeps the current rate if ratePerHour is omitted. Items never move the clock that other events use, and never change read status. Without at, an item takes the moment of the previous event (+0s, not +1s). A relative at on an item counts from the previous event or item; a relative at on a message still counts from the previous message."
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contact"
              },
              "at": {
                "type": "string",
                "minLength": 1
              },
              "set": {
                "type": "object",
                "properties": {
                  "firstName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lastName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "nickname": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "phone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "photo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false,
                "description": "The fields to change. A value sets the field, null removes it, and a field that is not given stays as it was."
              }
            },
            "required": [
              "type",
              "set"
            ],
            "additionalProperties": false,
            "description": "Changes the contact from this moment on, for example when the user saves or renames the contact. Renders nothing in the thread. Every snapshot at or after the item uses the changed contact. After the change, at least one of firstName, lastName, nickname or phone must remain. Items never move the clock that other events use, and never change read status. Without at, an item takes the moment of the previous event (+0s, not +1s). A relative at on an item counts from the previous event or item; a relative at on a message still counts from the previous message."
          }
        ]
      }
    },
    "snapshots": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "at": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "string",
                "const": "start"
              },
              {
                "type": "string",
                "const": "end"
              }
            ]
          },
          "time": {
            "type": "string"
          },
          "signalBars": {
            "type": "number"
          },
          "wifiBars": {
            "type": "number"
          },
          "batteryLevel": {
            "type": "number"
          },
          "lowPowerMode": {
            "type": "boolean"
          },
          "showKeyboard": {
            "type": "boolean"
          },
          "showDynamicIsland": {
            "type": "boolean"
          },
          "compose": {
            "type": "string"
          }
        },
        "required": [
          "at"
        ],
        "additionalProperties": false
      }
    },
    "scenes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "minLength": 1
          },
          "to": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "from",
          "to"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "settings",
    "events"
  ],
  "additionalProperties": false,
  "$id": "https://mockmsg.com/schema/conversation.json?version=0.sha256-fb20546b822dc306ca59fef7bf17d254d4ae44bbf7067441d9806594201d6e07",
  "x-schema-identity": "0.sha256-fb20546b822dc306ca59fef7bf17d254d4ae44bbf7067441d9806594201d6e07",
  "x-schema-major": 0
}
