{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/smry-ai/json-schema/smry-ai-library-item-schema.json",
  "title": "LibraryItem",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/smry-ai-openapi.json#/components/schemas/LibraryItem",
  "type": "object",
  "required": [
    "id",
    "url",
    "originalUrl",
    "title",
    "domain",
    "contentKind",
    "classification",
    "captureMethod",
    "format",
    "mimeType",
    "fileName",
    "asset",
    "externalId",
    "status",
    "starred",
    "tags",
    "savedAt",
    "updatedAt",
    "lastReadAt",
    "readProgress",
    "articleStatus"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "url": {
      "type": "string"
    },
    "originalUrl": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "title": {
      "type": "string"
    },
    "domain": {
      "type": "string"
    },
    "contentKind": {
      "anyOf": [
        {
          "const": "article",
          "type": "string"
        },
        {
          "const": "website",
          "type": "string"
        },
        {
          "const": "book",
          "type": "string"
        },
        {
          "const": "email",
          "type": "string"
        },
        {
          "const": "pdf",
          "type": "string"
        },
        {
          "const": "social_post",
          "type": "string"
        },
        {
          "const": "video",
          "type": "string"
        },
        {
          "const": "podcast_episode",
          "type": "string"
        },
        {
          "const": "document",
          "type": "string"
        },
        {
          "const": "unknown",
          "type": "string"
        }
      ]
    },
    "classification": {
      "type": "object",
      "required": [
        "method",
        "confidence",
        "version",
        "updatedAt"
      ],
      "properties": {
        "method": {
          "anyOf": [
            {
              "const": "user",
              "type": "string"
            },
            {
              "const": "source_adapter",
              "type": "string"
            },
            {
              "const": "mime",
              "type": "string"
            },
            {
              "const": "extension",
              "type": "string"
            },
            {
              "const": "url",
              "type": "string"
            },
            {
              "const": "metadata",
              "type": "string"
            },
            {
              "const": "legacy",
              "type": "string"
            },
            {
              "const": "fallback",
              "type": "string"
            }
          ]
        },
        "confidence": {
          "minimum": 0,
          "maximum": 100,
          "type": "integer"
        },
        "version": {
          "type": "string"
        },
        "updatedAt": {
          "type": "string"
        }
      }
    },
    "captureMethod": {
      "anyOf": [
        {
          "const": "reader",
          "type": "string"
        },
        {
          "const": "extension",
          "type": "string"
        },
        {
          "const": "upload",
          "type": "string"
        },
        {
          "const": "rss",
          "type": "string"
        },
        {
          "const": "email_inbox",
          "type": "string"
        },
        {
          "const": "api",
          "type": "string"
        },
        {
          "const": "import",
          "type": "string"
        }
      ]
    },
    "format": {
      "anyOf": [
        {
          "const": "html",
          "type": "string"
        },
        {
          "const": "pdf",
          "type": "string"
        },
        {
          "const": "epub",
          "type": "string"
        },
        {
          "const": "markdown",
          "type": "string"
        },
        {
          "const": "plain_text",
          "type": "string"
        },
        {
          "const": "document",
          "type": "string"
        },
        {
          "const": "spreadsheet",
          "type": "string"
        },
        {
          "const": "presentation",
          "type": "string"
        },
        {
          "const": "audio",
          "type": "string"
        },
        {
          "const": "video",
          "type": "string"
        },
        {
          "const": "unknown",
          "type": "string"
        }
      ]
    },
    "mimeType": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "fileName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "asset": {
      "anyOf": [
        {
          "$ref": "#/$defs/LibraryAsset"
        },
        {
          "type": "null"
        }
      ]
    },
    "externalId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "metadata": {
      "type": "object",
      "patternProperties": {
        "^(.*)$": {}
      }
    },
    "status": {
      "type": "string"
    },
    "starred": {
      "type": "boolean"
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "savedAt": {
      "type": "string"
    },
    "updatedAt": {
      "type": "string"
    },
    "lastReadAt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "readProgress": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "articleStatus": {
      "type": "string"
    },
    "article": {
      "$ref": "#/$defs/StoredArticle"
    }
  },
  "$defs": {
    "LibraryAsset": {
      "type": "object",
      "required": [
        "itemId",
        "fileName",
        "mimeType",
        "size",
        "checksum",
        "updatedAt",
        "resourceUri",
        "downloadUrl"
      ],
      "properties": {
        "itemId": {
          "description": "UUID that identifies the resource; pass it back exactly as smry returned it.",
          "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
          "type": "string"
        },
        "fileName": {
          "type": "string"
        },
        "mimeType": {
          "type": "string"
        },
        "size": {
          "type": "number"
        },
        "checksum": {
          "type": "string"
        },
        "updatedAt": {
          "type": "string"
        },
        "resourceUri": {
          "type": "string"
        },
        "downloadUrl": {
          "type": "string"
        }
      }
    },
    "StoredArticle": {
      "type": "object",
      "required": [
        "title",
        "textContent",
        "contentCharacters",
        "returnedCharacters",
        "truncated",
        "author",
        "publisher",
        "publishedAt",
        "language",
        "cachedAt"
      ],
      "properties": {
        "title": {
          "type": "string"
        },
        "textContent": {
          "type": "string"
        },
        "contentCharacters": {
          "type": "number"
        },
        "returnedCharacters": {
          "type": "number"
        },
        "truncated": {
          "type": "boolean"
        },
        "author": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "publisher": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "publishedAt": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "language": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "cachedAt": {
          "type": "string"
        }
      }
    }
  }
}