{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ditto-audio/json-schema/ditto-audio-sync-push-dto-schema.json",
  "title": "SyncPushDto",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ditto-audio-sync-api-openapi.yml#/components/schemas/SyncPushDto",
  "type": "object",
  "properties": {
    "books": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/UpsertBookDto"
      }
    },
    "progress": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/UpsertProgressDto"
      }
    },
    "bookmarks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/UpsertBookmarkDto"
      }
    },
    "annotations": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/UpsertAnnotationDto"
      }
    },
    "models": {
      "maxItems": 1000,
      "type": "array",
      "items": {
        "$ref": "#/$defs/UpsertModelRefDto"
      }
    },
    "audioChunks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/UpsertAudioChunkDto"
      }
    },
    "settings": {
      "$ref": "#/$defs/UpdateSettingsDto"
    }
  },
  "$defs": {
    "UpdateSettingsDto": {
      "type": "object",
      "properties": {
        "syncEnabled": {
          "type": "boolean"
        },
        "settings": {
          "type": "object",
          "description": "opaque client settings blob"
        }
      }
    },
    "UpsertAnnotationDto": {
      "type": "object",
      "properties": {
        "clientId": {
          "type": "string",
          "description": "client annotation id"
        },
        "bookId": {
          "type": "string"
        },
        "kind": {
          "type": "string",
          "enum": [
            "highlight",
            "note",
            "clipping"
          ]
        },
        "chapterIndex": {
          "type": "number"
        },
        "paragraphIndex": {
          "type": "number"
        },
        "cfi": {
          "type": "string"
        },
        "selectedText": {
          "type": "string"
        },
        "color": {
          "type": "string"
        },
        "noteContent": {
          "type": "string"
        },
        "chapterTitle": {
          "type": "string"
        },
        "createdAtMs": {
          "type": "number"
        },
        "deleted": {
          "type": "boolean"
        }
      },
      "required": [
        "clientId",
        "bookId",
        "kind"
      ]
    },
    "UpsertAudioChunkDto": {
      "type": "object",
      "properties": {
        "bookId": {
          "type": "string"
        },
        "chapterIndex": {
          "type": "number"
        },
        "paragraphIndex": {
          "type": "number"
        },
        "voiceId": {
          "type": "string"
        },
        "speed": {
          "type": "number",
          "default": 1
        },
        "sampleRate": {
          "type": "number",
          "default": 24000
        },
        "sentenceSamples": {
          "type": "array",
          "items": {
            "type": "number"
          }
        },
        "contentHash": {
          "type": "string"
        },
        "deleted": {
          "type": "boolean"
        }
      },
      "required": [
        "bookId",
        "chapterIndex",
        "paragraphIndex",
        "voiceId"
      ]
    },
    "UpsertBookDto": {
      "type": "object",
      "properties": {
        "bookId": {
          "type": "string",
          "description": "client book id (stable across devices)"
        },
        "title": {
          "type": "string"
        },
        "author": {
          "type": "string"
        },
        "format": {
          "type": "string"
        },
        "chapterCount": {
          "type": "number"
        },
        "contentHash": {
          "type": "string",
          "description": "sha-256 of the book file"
        },
        "coverImageUrl": {
          "type": "string"
        },
        "addedAtMs": {
          "type": "number",
          "description": "client add time, ms epoch"
        },
        "deleted": {
          "type": "boolean",
          "description": "tombstone — remove from cloud library"
        }
      },
      "required": [
        "bookId",
        "title"
      ]
    },
    "UpsertBookmarkDto": {
      "type": "object",
      "properties": {
        "clientId": {
          "type": "string",
          "description": "client bookmark id"
        },
        "bookId": {
          "type": "string"
        },
        "chapterIndex": {
          "type": "number"
        },
        "paragraphIndex": {
          "type": "number"
        },
        "cfi": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "note": {
          "type": "string"
        },
        "createdAtMs": {
          "type": "number"
        },
        "deleted": {
          "type": "boolean"
        }
      },
      "required": [
        "clientId",
        "bookId"
      ]
    },
    "UpsertModelRefDto": {
      "type": "object",
      "properties": {
        "modelId": {
          "type": "string"
        },
        "category": {
          "type": "string"
        },
        "isDefault": {
          "type": "boolean"
        },
        "lastUsedAtMs": {
          "type": "number"
        },
        "deleted": {
          "type": "boolean"
        }
      },
      "required": [
        "modelId"
      ]
    },
    "UpsertProgressDto": {
      "type": "object",
      "properties": {
        "bookId": {
          "type": "string"
        },
        "chapterIndex": {
          "type": "number"
        },
        "paragraphIndex": {
          "type": "number"
        },
        "cfi": {
          "type": "string",
          "description": "epub.js CFI (web reader)"
        },
        "percentComplete": {
          "type": "number",
          "description": "0..1"
        },
        "totalReadingTimeMs": {
          "type": "number"
        },
        "lastReadAtMs": {
          "type": "number"
        }
      }
    }
  }
}