{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "ankiReviewEntry": {
      "properties": {
        "durationMs": {
          "minimum": 0,
          "type": "integer"
        },
        "ease": {
          "maximum": 4,
          "minimum": 0,
          "type": "integer"
        },
        "factor": {
          "minimum": 0,
          "type": "integer"
        },
        "interval": {
          "type": "integer"
        },
        "previousInterval": {
          "type": "integer"
        },
        "reviewedAt": {
          "type": "integer"
        },
        "type": {
          "maximum": 3,
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "reviewedAt",
        "ease",
        "interval",
        "previousInterval",
        "factor",
        "durationMs",
        "type"
      ],
      "type": "object"
    },
    "main": {
      "description": "Optional metadata sidecar for a flashcard. rkey equals cardId. The sidecar keeps Anki import/review, scheduler, and media metadata separate from the replaceable card record; it remains publicly readable in the user's PDS.",
      "key": "any",
      "record": {
        "properties": {
          "ankiReviewHistory": {
            "description": "Anki revlog rows retained for APKG round trips. reviewedAt is the Anki Unix timestamp in milliseconds; durationMs is milliseconds; other numeric fields retain Anki's raw revlog values.",
            "items": {
              "ref": "#ankiReviewEntry",
              "type": "ref"
            },
            "type": "array"
          },
          "ankiSource": {
            "type": "string"
          },
          "cardId": {
            "description": "Flashcard id and this record's rkey.",
            "maxLength": 100,
            "type": "string"
          },
          "difficulty": {
            "description": "FSRS difficulty, stringified because AT Protocol has no float type.",
            "type": "string"
          },
          "flag": {
            "maximum": 7,
            "minimum": 0,
            "type": "integer"
          },
          "lapses": {
            "minimum": 0,
            "type": "integer"
          },
          "lastGrade": {
            "knownValues": [
              "again",
              "hard",
              "good",
              "easy"
            ],
            "type": "string"
          },
          "media": {
            "description": "Attached media manifest; file bytes are PDS blobs. The card text references media by name.",
            "items": {
              "ref": "#mediaEntry",
              "type": "ref"
            },
            "type": "array"
          },
          "problemRounds": {
            "minimum": 0,
            "type": "integer"
          },
          "stability": {
            "description": "FSRS stability in days, stringified because AT Protocol has no float type.",
            "type": "string"
          },
          "suspended": {
            "type": "boolean"
          }
        },
        "required": [
          "cardId"
        ],
        "type": "object"
      },
      "type": "record"
    },
    "mediaEntry": {
      "properties": {
        "blob": {
          "accept": [
            "image/*",
            "audio/*"
          ],
          "maxSize": 26214400,
          "type": "blob"
        },
        "mimeType": {
          "maxLength": 100,
          "type": "string"
        },
        "name": {
          "maxLength": 200,
          "type": "string"
        },
        "size": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "name",
        "mimeType",
        "size",
        "blob"
      ],
      "type": "object"
    }
  },
  "id": "app.studynext.cardMetadata",
  "lexicon": 1
}
