{
  "lexicon": 1,
  "id": "app.sidetrail.trail",
  "defs": {
    "main": {
      "type": "record",
      "description": "a sequential path to walk, one stop at a time",
      "key": "tid",
      "record": {
        "type": "object",
        "required": [
          "title",
          "description",
          "stops",
          "accentColor",
          "backgroundColor",
          "createdAt"
        ],
        "properties": {
          "title": {
            "type": "string",
            "maxGraphemes": 64,
            "maxLength": 640,
            "description": "trail title"
          },
          "description": {
            "type": "string",
            "maxGraphemes": 300,
            "maxLength": 3000,
            "description": "brief description of what this trail is about"
          },
          "stops": {
            "type": "array",
            "minLength": 2,
            "maxLength": 12,
            "items": {
              "type": "ref",
              "ref": "#stop"
            },
            "description": "sequence of stops in this trail (2-12 stops)"
          },
          "accentColor": {
            "type": "string",
            "description": "accent color for this trail (hex format, e.g., #e8a87c)"
          },
          "backgroundColor": {
            "type": "string",
            "description": "background color for this trail (hex format, e.g., #fdf8f3)"
          },
          "createdAt": {
            "type": "string",
            "format": "datetime"
          }
        }
      }
    },
    "stop": {
      "type": "object",
      "description": "a single stop in a trail",
      "required": ["tid", "title", "content"],
      "properties": {
        "tid": {
          "type": "string",
          "format": "tid",
          "description": "stable identifier for this stop (survives reordering/edits)"
        },
        "title": {
          "type": "string",
          "maxGraphemes": 64,
          "maxLength": 640,
          "description": "stop title"
        },
        "content": {
          "type": "string",
          "maxGraphemes": 1000,
          "maxLength": 10000,
          "description": "stop content text"
        },
        "buttonText": {
          "type": "string",
          "maxGraphemes": 20,
          "maxLength": 200,
          "description": "custom button text (e.g., 'got it', 'done that')"
        },
        "external": {
          "type": "ref",
          "ref": "#external",
          "description": "embedded link with preview metadata"
        }
      }
    },
    "external": {
      "type": "object",
      "description": "link preview metadata",
      "required": ["uri"],
      "properties": {
        "uri": {
          "type": "string",
          "format": "uri",
          "description": "URL of the external resource"
        },
        "title": {
          "type": "string",
          "maxLength": 500,
          "maxGraphemes": 500
        },
        "description": {
          "type": "string",
          "maxLength": 5000,
          "maxGraphemes": 1000
        },
        "thumb": {
          "type": "blob",
          "accept": ["image/*"],
          "maxSize": 1000000,
          "description": "preview image"
        }
      }
    }
  }
}
