{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://mangle.icebreaker.top/schemas/tailwindcss-patch/validate-result.schema.json",
  "title": "tailwindcss-patch validate result",
  "description": "Schema for JSON output from `tw-patch validate --json`.",
  "oneOf": [
    {
      "$ref": "#/$defs/success"
    },
    {
      "$ref": "#/$defs/failure"
    }
  ],
  "$defs": {
    "success": {
      "type": "object",
      "required": [
        "ok",
        "cwd",
        "reportFile",
        "dryRun",
        "strict",
        "scannedEntries",
        "restorableEntries",
        "restoredFiles",
        "missingBackups",
        "skippedEntries",
        "restored"
      ],
      "properties": {
        "ok": {
          "type": "boolean",
          "const": true
        },
        "cwd": {
          "type": "string"
        },
        "reportFile": {
          "type": "string"
        },
        "reportKind": {
          "type": "string",
          "const": "tw-patch-migrate-report"
        },
        "reportSchemaVersion": {
          "type": "integer",
          "minimum": 1
        },
        "dryRun": {
          "type": "boolean"
        },
        "strict": {
          "type": "boolean"
        },
        "scannedEntries": {
          "type": "integer",
          "minimum": 0
        },
        "restorableEntries": {
          "type": "integer",
          "minimum": 0
        },
        "restoredFiles": {
          "type": "integer",
          "minimum": 0
        },
        "missingBackups": {
          "type": "integer",
          "minimum": 0
        },
        "skippedEntries": {
          "type": "integer",
          "minimum": 0
        },
        "restored": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    },
    "failure": {
      "type": "object",
      "required": [
        "ok",
        "reason",
        "exitCode",
        "message"
      ],
      "properties": {
        "ok": {
          "type": "boolean",
          "const": false
        },
        "reason": {
          "type": "string",
          "enum": [
            "report-incompatible",
            "missing-backups",
            "io-error",
            "unknown-error"
          ]
        },
        "exitCode": {
          "type": "integer",
          "enum": [
            21,
            22,
            23,
            24
          ]
        },
        "message": {
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  }
}
