{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://getcaute.com/card-format/1/manifest.schema.json",
  "title": "manifest.json",
  "description": "What the export holds and which version of the card format it is.",
  "$defs": {
    "datetime": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}[ T]\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?([+-]\\d{2}:\\d{2}|Z)$",
      "description": "A date and time with its offset (RFC 3339), written with a space between date and time: 2026-10-14 03:04:05.123456+00:00. Fractional seconds are left out when they are zero."
    },
    "uuid": {
      "type": "string",
      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
    }
  },
  "type": "object",
  "required": [
    "export_format",
    "created_at",
    "workspace",
    "requested_by",
    "spaces",
    "counts"
  ],
  "additionalProperties": false,
  "properties": {
    "export_format": {
      "const": 1,
      "description": "The card format's version. Additive changes keep it; anything else is a new number."
    },
    "created_at": {
      "$ref": "#/$defs/datetime"
    },
    "workspace": {
      "type": "object",
      "required": [
        "id",
        "name",
        "kind"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/uuid"
        },
        "name": {
          "type": "string"
        },
        "kind": {
          "type": "string",
          "description": "personal or team; read unknown values as other."
        }
      }
    },
    "requested_by": {
      "type": "string",
      "description": "The email address of the person the export was made for."
    },
    "spaces": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The names of the spaces included: those the person could read in this workspace when it was made."
    },
    "counts": {
      "type": "object",
      "required": [
        "items",
        "originals",
        "notes",
        "highlights",
        "tags",
        "links",
        "saved_searches",
        "questions"
      ],
      "additionalProperties": false,
      "properties": {
        "items": {
          "type": "integer",
          "minimum": 0
        },
        "originals": {
          "type": "integer",
          "minimum": 0
        },
        "notes": {
          "type": "integer",
          "minimum": 0
        },
        "highlights": {
          "type": "integer",
          "minimum": 0
        },
        "tags": {
          "type": "integer",
          "minimum": 0
        },
        "links": {
          "type": "integer",
          "minimum": 0
        },
        "saved_searches": {
          "type": "integer",
          "minimum": 0
        },
        "questions": {
          "type": "integer",
          "minimum": 0
        }
      }
    }
  }
}
