{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://winregistry.org/schemas/shortcut-result-v1.json",
  "title": "regx native Windows shortcut result v1",
  "oneOf": [
    { "$ref": "#/$defs/link" },
    { "$ref": "#/$defs/apply" }
  ],
  "$defs": {
    "sha256": {
      "type": ["string", "null"],
      "pattern": "^[0-9a-f]{64}$"
    },
    "link": {
      "type": "object",
      "required": [
        "schemaVersion", "command", "action", "dryRun", "replaced",
        "file", "target", "arguments", "workingDirectory", "description",
        "iconPath", "iconIndex", "style", "sha256"
      ],
      "properties": {
        "schemaVersion": { "const": 1 },
        "command": { "const": "lnk" },
        "action": { "enum": ["create", "inspect", "delete"] },
        "dryRun": { "type": "boolean" },
        "replaced": { "type": "boolean" },
        "file": { "type": "string", "minLength": 1 },
        "target": { "type": "string" },
        "arguments": { "type": "string" },
        "workingDirectory": { "type": ["string", "null"] },
        "description": { "type": "string" },
        "iconPath": { "type": ["string", "null"] },
        "iconIndex": { "type": "integer" },
        "style": { "enum": ["normal", "hidden", "minimized"] },
        "sha256": { "$ref": "#/$defs/sha256" }
      },
      "additionalProperties": false
    },
    "applyAction": {
      "type": "object",
      "required": ["operation", "path"],
      "properties": {
        "operation": { "enum": ["create", "delete"] },
        "path": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    },
    "apply": {
      "type": "object",
      "required": ["schemaVersion", "command", "dryRun", "failed", "actions"],
      "properties": {
        "schemaVersion": { "const": 1 },
        "command": { "const": "lnk.apply" },
        "dryRun": { "type": "boolean" },
        "failed": { "type": "boolean" },
        "actions": {
          "type": "array",
          "minItems": 1,
          "maxItems": 1000,
          "items": { "$ref": "#/$defs/applyAction" }
        }
      },
      "additionalProperties": false
    }
  }
}
