{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://ytptube.app/schemas/conditions.json",
  "title": "YTPTube Download Conditions",
  "description": "Schema describing conditional rules evaluated against yt-dlp info dicts.",
  "type": "array",
  "items": {
    "type": "object",
    "additionalProperties": false,
    "required": [
      "id",
      "name",
      "filter"
    ],
    "properties": {
      "id": {
        "type": "string",
        "description": "Unique identifier for the condition (UUID)."
      },
      "name": {
        "type": "string",
        "description": "Human-readable name for the condition."
      },
      "filter": {
        "type": "string",
        "description": "Filter expression to evaluate against info dict."
      },
      "cli": {
        "type": "string",
        "description": "yt-dlp CLI fragment to append if matched.",
        "default": ""
      },
      "extras": {
        "type": "object",
        "description": "Any extra data to store with the condition.",
        "default": {}
      },
      "enabled": {
        "type": "boolean",
        "description": "Whether the condition is enabled.",
        "default": true
      },
      "priority": {
        "type": "integer",
        "description": "Priority of the condition.",
        "default": 0,
        "minimum": 0
      },
      "description": {
        "type": "string",
        "description": "A description of what the condition does.",
        "default": ""
      }
    },
    "examples": [
      {
        "id": "a2b3c4d5-6789-2345-0bcd-ef1234567890",
        "name": "Long Videos",
        "filter": "duration>3600",
        "extras": {
          "ignore_download": true
        },
        "enabled": true,
        "priority": 10,
        "description": "Ignore downloads for videos longer than 1 hour."
      },
      {
        "id": "b3c4d5e6-7890-3456-1cde-f23456789012",
        "name": "Use Audio Preset for Music",
        "filter": "categories~='Music'",
        "extras": {
          "set_preset": "audio-only"
        },
        "enabled": false,
        "priority": 0,
        "description": "Apply audio-only preset for videos in the Music category."
      }
    ]
  }
}
