{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://validiscan.com/schemas/evidence-package/v1.json",
  "title": "Validiscan Remediation Evidence Package",
  "type": "object",
  "properties": {
    "payloadVersion": {
      "type": "number",
      "const": 1
    },
    "cover": {
      "$ref": "#/$defs/Cover"
    },
    "scope": {
      "$ref": "#/$defs/Scope"
    },
    "summary": {
      "$ref": "#/$defs/Summary"
    },
    "findings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FindingRecord"
      }
    },
    "manualReview": {
      "$ref": "#/$defs/ManualReview"
    },
    "residualRisk": {
      "$ref": "#/$defs/ResidualRisk"
    },
    "recommendations": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Recommendation"
      }
    },
    "schedule": {
      "$ref": "#/$defs/Schedule"
    },
    "statement": {
      "$ref": "#/$defs/StatementInputs"
    },
    "onReady": {
      "type": "object",
      "properties": {
        "verifyFindingIds": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Uuid"
          }
        }
      },
      "required": ["verifyFindingIds"],
      "additionalProperties": false
    }
  },
  "required": [
    "payloadVersion",
    "cover",
    "scope",
    "summary",
    "findings",
    "manualReview",
    "residualRisk",
    "recommendations",
    "schedule",
    "statement",
    "onReady"
  ],
  "additionalProperties": false,
  "description": "Payload (JSON file) of a Validiscan Remediation Evidence Package: the seven sections of the report as data. onReady.verifyFindingIds are the findings the worker moves from fixed to verified when the package becomes ready.",
  "$defs": {
    "Cover": {
      "type": "object",
      "properties": {
        "packageId": {
          "$ref": "#/$defs/Uuid"
        },
        "version": {
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991
        },
        "locale": {
          "type": "string",
          "enum": ["en", "da", "de", "fr", "es"]
        },
        "generatedAt": {
          "$ref": "#/$defs/Instant"
        },
        "timeZone": {
          "type": "string",
          "minLength": 1
        },
        "site": {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/Uuid"
            },
            "name": {
              "type": "string",
              "minLength": 1
            },
            "url": {
              "type": "string",
              "format": "uri"
            },
            "platform": {
              "type": "string",
              "enum": ["shopify", "shopware", "woocommerce", "magento", "other"]
            },
            "platformVersion": {
              "type": ["string", "null"]
            }
          },
          "required": ["id", "name", "url", "platform", "platformVersion"],
          "additionalProperties": false
        },
        "organization": {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/Uuid"
            },
            "name": {
              "type": "string",
              "minLength": 1
            },
            "country": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^[A-Z]{2}$"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": ["id", "name", "country"],
          "additionalProperties": false
        },
        "contact": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1
            },
            "email": {
              "type": "string",
              "format": "email",
              "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
            },
            "url": {
              "type": "string",
              "format": "uri"
            }
          },
          "required": ["name", "email", "url"],
          "additionalProperties": false
        },
        "generator": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1
            },
            "version": {
              "type": "string",
              "minLength": 1
            }
          },
          "required": ["name", "version"],
          "additionalProperties": false
        },
        "payloadSha256": {
          "$ref": "#/$defs/Sha256"
        }
      },
      "required": [
        "packageId",
        "version",
        "locale",
        "generatedAt",
        "timeZone",
        "site",
        "organization",
        "contact",
        "generator",
        "payloadSha256"
      ],
      "additionalProperties": false,
      "description": "Section 1. timeZone is the merchant organization’s IANA zone. payloadSha256 is the SHA-256 of the canonical JSON (RFC 8785) of the whole payload without cover.payloadSha256."
    },
    "Uuid": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "Instant": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
      "description": "UTC instant in Date#toISOString form, e.g. 2026-09-25T12:00:00.000Z"
    },
    "Sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$",
      "description": "Lower-case hex SHA-256"
    },
    "Scope": {
      "type": "object",
      "properties": {
        "scan": {
          "$ref": "#/$defs/ScanRecord"
        },
        "verificationScan": {
          "anyOf": [
            {
              "$ref": "#/$defs/ScanRecord"
            },
            {
              "type": "null"
            }
          ]
        },
        "pages": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PageRecord"
          }
        },
        "templates": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TemplateCoverage"
          }
        },
        "viewports": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Viewport"
          }
        },
        "standards": {
          "$ref": "#/$defs/StandardsSnapshot"
        },
        "limitations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Limitation"
          }
        }
      },
      "required": [
        "scan",
        "verificationScan",
        "pages",
        "templates",
        "viewports",
        "standards",
        "limitations"
      ],
      "additionalProperties": false,
      "description": "Section 2: scope and methodology."
    },
    "ScanRecord": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/Uuid"
        },
        "role": {
          "type": "string",
          "enum": ["scan", "verification"]
        },
        "kind": {
          "type": "string",
          "enum": ["full", "verification", "monitor"]
        },
        "startedAt": {
          "$ref": "#/$defs/Instant"
        },
        "finishedAt": {
          "$ref": "#/$defs/Instant"
        },
        "pageCount": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "templates": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PageTemplate"
          }
        },
        "viewports": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Viewport"
          }
        },
        "crawlConfig": {
          "$ref": "#/$defs/CrawlConfig"
        },
        "limitedToTemplates": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "$ref": "#/$defs/PageTemplate"
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "mustVisit": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "pages": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "findings": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "omittedFindings": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "revisited": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": ["pages", "findings", "omittedFindings", "revisited"],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "toolVersions": {
          "$ref": "#/$defs/ToolVersions"
        }
      },
      "required": [
        "id",
        "role",
        "kind",
        "startedAt",
        "finishedAt",
        "pageCount",
        "templates",
        "viewports",
        "crawlConfig",
        "limitedToTemplates",
        "mustVisit",
        "toolVersions"
      ],
      "additionalProperties": false
    },
    "PageTemplate": {
      "type": "string",
      "enum": [
        "home",
        "plp",
        "pdp",
        "cart",
        "checkout",
        "search",
        "account",
        "content",
        "legal",
        "other"
      ]
    },
    "Viewport": {
      "type": "string",
      "enum": ["desktop", "mobile"]
    },
    "CrawlConfig": {
      "type": "object",
      "properties": {
        "maxPages": {
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991
        },
        "samplesPerTemplate": {
          "type": "object",
          "properties": {
            "home": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "plp": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "pdp": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "cart": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "checkout": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "search": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "account": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "content": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "legal": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "other": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "home",
            "plp",
            "pdp",
            "cart",
            "checkout",
            "search",
            "account",
            "content",
            "legal",
            "other"
          ],
          "additionalProperties": false
        },
        "cookieStrategy": {
          "type": "string",
          "enum": ["accept", "reject", "leave"]
        },
        "ignoreRobots": {
          "type": "boolean"
        },
        "blockTrackers": {
          "type": "boolean"
        },
        "viewports": {
          "minItems": 1,
          "type": "array",
          "items": {
            "$ref": "#/$defs/Viewport"
          }
        },
        "flows": {
          "type": "object",
          "properties": {
            "addToCart": {
              "type": "boolean"
            },
            "checkout": {
              "type": "boolean"
            },
            "search": {
              "type": "boolean"
            },
            "account": {
              "type": "boolean"
            },
            "legal": {
              "type": "boolean"
            }
          },
          "required": ["addToCart", "checkout", "search", "account", "legal"],
          "additionalProperties": false
        },
        "excludePatterns": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "hostOverride": {
          "type": "boolean"
        }
      },
      "required": [
        "maxPages",
        "samplesPerTemplate",
        "cookieStrategy",
        "ignoreRobots",
        "blockTrackers",
        "viewports",
        "flows",
        "excludePatterns",
        "hostOverride"
      ],
      "additionalProperties": false,
      "description": "Effective crawl configuration of a scan (scans.config with defaults applied)."
    },
    "ToolVersions": {
      "type": "object",
      "properties": {
        "axeCore": {
          "type": ["string", "null"]
        },
        "playwright": {
          "type": ["string", "null"]
        },
        "scanner": {
          "type": ["string", "null"]
        },
        "ruleSetHash": {
          "type": ["string", "null"]
        },
        "other": {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "type": "string"
          }
        }
      },
      "required": ["axeCore", "playwright", "scanner", "ruleSetHash", "other"],
      "additionalProperties": false
    },
    "PageRecord": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/Uuid"
        },
        "scanId": {
          "$ref": "#/$defs/Uuid"
        },
        "scanRole": {
          "type": "string",
          "enum": ["scan", "verification"]
        },
        "url": {
          "type": "string",
          "minLength": 1
        },
        "template": {
          "$ref": "#/$defs/PageTemplate"
        },
        "viewport": {
          "$ref": "#/$defs/Viewport"
        },
        "statusCode": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "title": {
          "type": ["string", "null"]
        },
        "lang": {
          "type": ["string", "null"]
        },
        "error": {
          "type": ["string", "null"]
        },
        "screenshot": {
          "anyOf": [
            {
              "$ref": "#/$defs/StorageRef"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "scanId",
        "scanRole",
        "url",
        "template",
        "viewport",
        "statusCode",
        "title",
        "lang",
        "error",
        "screenshot"
      ],
      "additionalProperties": false
    },
    "StorageRef": {
      "type": "object",
      "properties": {
        "bucket": {
          "type": "string",
          "enum": ["screenshots", "raw-scans", "evidence", "deliveries", "uploads"]
        },
        "path": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": ["bucket", "path"],
      "additionalProperties": false,
      "description": "Object in a private Supabase Storage bucket (EU). Never a URL: downloads use short-lived signed URLs."
    },
    "TemplateCoverage": {
      "type": "object",
      "properties": {
        "template": {
          "$ref": "#/$defs/PageTemplate"
        },
        "scanPages": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "verificationPages": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "viewports": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Viewport"
          }
        }
      },
      "required": ["template", "scanPages", "verificationPages", "viewports"],
      "additionalProperties": false
    },
    "StandardsSnapshot": {
      "type": "object",
      "properties": {
        "lastVerified": {
          "$ref": "#/$defs/IsoDate"
        },
        "wcag": {
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "version": {
                "$ref": "#/$defs/WcagVersion"
              },
              "name": {
                "type": "string"
              },
              "publishedOn": {
                "$ref": "#/$defs/IsoDate"
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "role": {
                "type": "string",
                "enum": ["legal-reference", "target"]
              }
            },
            "required": ["version", "name", "publishedOn", "url", "role"],
            "additionalProperties": false
          }
        },
        "en301549": {
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "publishedOn": {
                "$ref": "#/$defs/IsoDate"
              },
              "citedInOJEU": {
                "type": "boolean"
              },
              "status": {
                "type": "string",
                "enum": ["cited", "published", "superseded"]
              },
              "mapsToWcag": {
                "$ref": "#/$defs/WcagVersion"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            },
            "required": [
              "version",
              "name",
              "publishedOn",
              "citedInOJEU",
              "status",
              "mapsToWcag",
              "url"
            ],
            "additionalProperties": false
          }
        },
        "legalReference": {
          "type": "object",
          "properties": {
            "en301549": {
              "type": "string"
            },
            "wcag": {
              "$ref": "#/$defs/WcagVersion"
            }
          },
          "required": ["en301549", "wcag"],
          "additionalProperties": false
        },
        "latest": {
          "type": "object",
          "properties": {
            "en301549": {
              "type": "string"
            },
            "wcag": {
              "$ref": "#/$defs/WcagVersion"
            }
          },
          "required": ["en301549", "wcag"],
          "additionalProperties": false
        },
        "eaa": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "directive": {
              "type": "string"
            },
            "appliesFrom": {
              "$ref": "#/$defs/IsoDate"
            },
            "url": {
              "type": "string",
              "format": "uri"
            }
          },
          "required": ["name", "directive", "appliesFrom", "url"],
          "additionalProperties": false
        },
        "bfsg": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "appliesFrom": {
              "$ref": "#/$defs/IsoDate"
            }
          },
          "required": ["name", "appliesFrom"],
          "additionalProperties": false
        }
      },
      "required": ["lastVerified", "wcag", "en301549", "legalReference", "latest", "eaa", "bfsg"],
      "additionalProperties": false,
      "description": "packages/rules/src/standards.ts when the package was built; also stored in evidence_packages.standards."
    },
    "IsoDate": {
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "WcagVersion": {
      "type": "string",
      "enum": ["2.1", "2.2"]
    },
    "Limitation": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "automated_subset",
            "sampled_pages",
            "point_in_time",
            "checkout_first_step",
            "third_party_frames",
            "manual_review_incomplete",
            "no_verification_scan",
            "verification_limited",
            "page_errors"
          ]
        },
        "count": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "templates": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PageTemplate"
          }
        }
      },
      "required": ["code", "count", "templates"],
      "additionalProperties": false
    },
    "Summary": {
      "type": "object",
      "properties": {
        "findingsByImpact": {
          "type": "object",
          "properties": {
            "critical": {
              "$ref": "#/$defs/FindingStatusCounts"
            },
            "serious": {
              "$ref": "#/$defs/FindingStatusCounts"
            },
            "moderate": {
              "$ref": "#/$defs/FindingStatusCounts"
            },
            "minor": {
              "$ref": "#/$defs/FindingStatusCounts"
            }
          },
          "required": ["critical", "serious", "moderate", "minor"],
          "additionalProperties": false
        },
        "totals": {
          "type": "object",
          "properties": {
            "findings": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "instances": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "bestPracticeFindings": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": ["findings", "instances", "bestPracticeFindings"],
          "additionalProperties": false
        },
        "conformance": {
          "type": "object",
          "properties": {
            "wcag21aa": {
              "$ref": "#/$defs/ConformanceTable"
            },
            "wcag22aa": {
              "$ref": "#/$defs/ConformanceTable"
            }
          },
          "required": ["wcag21aa", "wcag22aa"],
          "additionalProperties": false
        },
        "remediationProgress": {
          "$ref": "#/$defs/RemediationProgress"
        }
      },
      "required": ["findingsByImpact", "totals", "conformance", "remediationProgress"],
      "additionalProperties": false,
      "description": "Section 3: results summary."
    },
    "FindingStatusCounts": {
      "type": "object",
      "properties": {
        "open": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "fix_proposed": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "fix_delivered": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "fixed": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "verified": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "resolved_externally": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "wontfix": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "false_positive": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "open",
        "fix_proposed",
        "fix_delivered",
        "fixed",
        "verified",
        "resolved_externally",
        "wontfix",
        "false_positive"
      ],
      "additionalProperties": false
    },
    "ConformanceTable": {
      "type": "object",
      "properties": {
        "target": {
          "type": "string",
          "enum": ["wcag21aa", "wcag22aa"]
        },
        "wcagVersion": {
          "$ref": "#/$defs/WcagVersion"
        },
        "en301549Version": {
          "type": "string"
        },
        "counts": {
          "type": "object",
          "properties": {
            "supports": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "partially_supports": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "does_not_support": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "not_applicable": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "not_evaluated": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "supports",
            "partially_supports",
            "does_not_support",
            "not_applicable",
            "not_evaluated"
          ],
          "additionalProperties": false
        },
        "criteria": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CriterionResult"
          }
        }
      },
      "required": ["target", "wcagVersion", "en301549Version", "counts", "criteria"],
      "additionalProperties": false
    },
    "CriterionResult": {
      "type": "object",
      "properties": {
        "criterion": {
          "$ref": "#/$defs/WcagCriterion"
        },
        "wcagLevel": {
          "type": "string",
          "enum": ["A", "AA"]
        },
        "newIn22": {
          "type": "boolean"
        },
        "en301549Clause": {
          "anyOf": [
            {
              "$ref": "#/$defs/En301549Clause"
            },
            {
              "type": "null"
            }
          ]
        },
        "conformance": {
          "$ref": "#/$defs/ConformanceLevel"
        },
        "basis": {
          "type": "string",
          "enum": [
            "always_satisfied",
            "unresolved_failures",
            "unresolved_failures_some_templates",
            "automated_pass_manual_fail",
            "manual_fail",
            "fixed_awaiting_verification",
            "manual_not_applicable",
            "manual_pass",
            "automated_pass",
            "manual_review_pending",
            "not_covered"
          ]
        },
        "automation": {
          "type": "string",
          "enum": ["full", "partial", "none"]
        },
        "manualResult": {
          "anyOf": [
            {
              "$ref": "#/$defs/ManualResult"
            },
            {
              "type": "null"
            }
          ]
        },
        "findings": {
          "type": "object",
          "properties": {
            "unresolved": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/Uuid"
              }
            },
            "pendingVerification": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/Uuid"
              }
            },
            "resolved": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/Uuid"
              }
            }
          },
          "required": ["unresolved", "pendingVerification", "resolved"],
          "additionalProperties": false
        },
        "templatesAffected": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PageTemplate"
          }
        }
      },
      "required": [
        "criterion",
        "wcagLevel",
        "newIn22",
        "en301549Clause",
        "conformance",
        "basis",
        "automation",
        "manualResult",
        "findings",
        "templatesAffected"
      ],
      "additionalProperties": false,
      "description": "Conformance of one success criterion; basis names the rule that decided it (docs/adr/004-evidence-package.md)."
    },
    "WcagCriterion": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$",
      "description": "WCAG success criterion number, e.g. 1.4.3"
    },
    "En301549Clause": {
      "type": "string",
      "pattern": "^9\\.\\d+\\.\\d+\\.\\d+$",
      "description": "EN 301 549 clause 9 number, e.g. 9.1.4.3"
    },
    "ConformanceLevel": {
      "type": "string",
      "enum": [
        "supports",
        "partially_supports",
        "does_not_support",
        "not_applicable",
        "not_evaluated"
      ]
    },
    "ManualResult": {
      "type": "string",
      "enum": ["pass", "fail", "na", "not_checked"]
    },
    "RemediationProgress": {
      "type": "object",
      "properties": {
        "value": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "doneWeight": {
          "type": "number",
          "minimum": 0
        },
        "totalWeight": {
          "type": "number",
          "minimum": 0
        },
        "weights": {
          "type": "object",
          "properties": {
            "critical": {
              "type": "number"
            },
            "serious": {
              "type": "number"
            },
            "moderate": {
              "type": "number"
            },
            "minor": {
              "type": "number"
            }
          },
          "required": ["critical", "serious", "moderate", "minor"],
          "additionalProperties": false
        },
        "countsAsDone": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FindingStatus"
          }
        },
        "excludedStatuses": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FindingStatus"
          }
        },
        "excludesBestPractice": {
          "type": "boolean",
          "const": true
        }
      },
      "required": [
        "value",
        "doneWeight",
        "totalWeight",
        "weights",
        "countsAsDone",
        "excludedStatuses",
        "excludesBestPractice"
      ],
      "additionalProperties": false,
      "description": "value = doneWeight / totalWeight: impact weights of findings with a countsAsDone status over all findings, without excludedStatuses and best-practice findings (brief §2.3)."
    },
    "FindingStatus": {
      "type": "string",
      "enum": [
        "open",
        "fix_proposed",
        "fix_delivered",
        "fixed",
        "verified",
        "resolved_externally",
        "wontfix",
        "false_positive"
      ]
    },
    "FindingRecord": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/Uuid"
        },
        "ruleId": {
          "type": "string",
          "minLength": 1
        },
        "source": {
          "type": "string",
          "enum": ["axe", "validiscan", "manual"]
        },
        "title": {
          "type": "string"
        },
        "summary": {
          "type": ["string", "null"]
        },
        "helpUrl": {
          "type": ["string", "null"]
        },
        "impact": {
          "$ref": "#/$defs/Impact"
        },
        "tier": {
          "type": "string",
          "enum": ["auto", "assisted", "manual"]
        },
        "status": {
          "$ref": "#/$defs/FindingStatus"
        },
        "verifiedByThisPackage": {
          "type": "boolean"
        },
        "bestPractice": {
          "type": "boolean"
        },
        "wcagCriteria": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WcagCriterion"
          }
        },
        "en301549": {
          "type": "object",
          "properties": {
            "legalReference": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/En301549Clause"
              }
            },
            "latest": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/En301549Clause"
              }
            }
          },
          "required": ["legalReference", "latest"],
          "additionalProperties": false
        },
        "instanceCount": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "pageCount": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "inScan": {
          "$ref": "#/$defs/Occurrence"
        },
        "inVerificationScan": {
          "anyOf": [
            {
              "$ref": "#/$defs/Occurrence"
            },
            {
              "type": "null"
            }
          ]
        },
        "firstSeenScanId": {
          "anyOf": [
            {
              "$ref": "#/$defs/Uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "lastSeenScanId": {
          "anyOf": [
            {
              "$ref": "#/$defs/Uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "examples": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ExampleRecord"
          }
        },
        "figures": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FigureRecord"
          }
        },
        "fixes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FixRecord"
          }
        },
        "exclusion": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "reason": {
                  "type": "string",
                  "enum": ["false_positive", "wontfix"]
                },
                "justification": {
                  "type": ["string", "null"]
                },
                "justificationSource": {
                  "type": "string",
                  "enum": ["ignore_rule", "finding_notes", "none"]
                }
              },
              "required": ["reason", "justification", "justificationSource"],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "ruleId",
        "source",
        "title",
        "summary",
        "helpUrl",
        "impact",
        "tier",
        "status",
        "verifiedByThisPackage",
        "bestPractice",
        "wcagCriteria",
        "en301549",
        "instanceCount",
        "pageCount",
        "inScan",
        "inVerificationScan",
        "firstSeenScanId",
        "lastSeenScanId",
        "examples",
        "figures",
        "fixes",
        "exclusion"
      ],
      "additionalProperties": false,
      "description": "Section 4 (and the excluded findings of section 5): one finding with its evidence. status is the status the package documents: verified when verifiedByThisPackage."
    },
    "Impact": {
      "type": "string",
      "enum": ["critical", "serious", "moderate", "minor"]
    },
    "Occurrence": {
      "type": "object",
      "properties": {
        "instances": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "pages": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "templates": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PageTemplate"
          }
        }
      },
      "required": ["instances", "pages", "templates"],
      "additionalProperties": false
    },
    "ExampleRecord": {
      "type": "object",
      "properties": {
        "pageUrl": {
          "type": "string"
        },
        "template": {
          "$ref": "#/$defs/PageTemplate"
        },
        "viewport": {
          "$ref": "#/$defs/Viewport"
        },
        "selector": {
          "type": "string"
        },
        "failureSummary": {
          "type": ["string", "null"]
        }
      },
      "required": ["pageUrl", "template", "viewport", "selector", "failureSummary"],
      "additionalProperties": false
    },
    "FigureRecord": {
      "type": "object",
      "properties": {
        "role": {
          "type": "string",
          "enum": ["before", "after"]
        },
        "image": {
          "$ref": "#/$defs/StorageRef"
        },
        "scanId": {
          "$ref": "#/$defs/Uuid"
        },
        "pageUrl": {
          "type": "string"
        },
        "template": {
          "$ref": "#/$defs/PageTemplate"
        },
        "viewport": {
          "$ref": "#/$defs/Viewport"
        },
        "selector": {
          "type": ["string", "null"]
        },
        "stillPresent": {
          "type": "boolean"
        }
      },
      "required": [
        "role",
        "image",
        "scanId",
        "pageUrl",
        "template",
        "viewport",
        "selector",
        "stillPresent"
      ],
      "additionalProperties": false,
      "description": "A representative screenshot: before (the scan) or after (the verification scan, same URL and viewport)."
    },
    "FixRecord": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/Uuid"
        },
        "tier": {
          "type": "string",
          "enum": ["auto", "assisted", "manual"]
        },
        "status": {
          "type": "string",
          "enum": [
            "draft",
            "proposed",
            "approved",
            "delivering",
            "delivered",
            "merged",
            "rejected",
            "failed"
          ]
        },
        "strategy": {
          "type": "string"
        },
        "generatedBy": {
          "type": "string",
          "enum": ["recipe", "ai", "human"]
        },
        "reviewedAt": {
          "anyOf": [
            {
              "$ref": "#/$defs/Instant"
            },
            {
              "type": "null"
            }
          ]
        },
        "deliveredAt": {
          "anyOf": [
            {
              "$ref": "#/$defs/Instant"
            },
            {
              "type": "null"
            }
          ]
        },
        "delivery": {
          "anyOf": [
            {
              "$ref": "#/$defs/DeliveryRecord"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "tier",
        "status",
        "strategy",
        "generatedBy",
        "reviewedAt",
        "deliveredAt",
        "delivery"
      ],
      "additionalProperties": false
    },
    "DeliveryRecord": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/Uuid"
        },
        "kind": {
          "type": "string",
          "enum": ["github_pr", "shopify_theme", "zip"]
        },
        "ref": {
          "type": ["string", "null"]
        },
        "status": {
          "type": "string",
          "enum": ["pending", "delivered", "merged", "closed", "failed"]
        },
        "deliveredAt": {
          "anyOf": [
            {
              "$ref": "#/$defs/Instant"
            },
            {
              "type": "null"
            }
          ]
        },
        "mergedAt": {
          "anyOf": [
            {
              "$ref": "#/$defs/Instant"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": ["id", "kind", "ref", "status", "deliveredAt", "mergedAt"],
      "additionalProperties": false
    },
    "ManualReview": {
      "type": "object",
      "properties": {
        "checks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ManualCheckRecord"
          }
        },
        "counts": {
          "type": "object",
          "properties": {
            "pass": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "fail": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "na": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "not_checked": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": ["pass", "fail", "na", "not_checked"],
          "additionalProperties": false
        },
        "missing": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WcagCriterion"
          }
        }
      },
      "required": ["checks", "counts", "missing"],
      "additionalProperties": false,
      "description": "Section 5: manual review results."
    },
    "ManualCheckRecord": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/Uuid"
        },
        "scanId": {
          "$ref": "#/$defs/Uuid"
        },
        "criterion": {
          "$ref": "#/$defs/WcagCriterion"
        },
        "result": {
          "$ref": "#/$defs/ManualResult"
        },
        "notes": {
          "type": ["string", "null"]
        },
        "evidence": {
          "anyOf": [
            {
              "$ref": "#/$defs/StorageRef"
            },
            {
              "type": "null"
            }
          ]
        },
        "checkedBy": {
          "type": ["string", "null"]
        },
        "checkedAt": {
          "anyOf": [
            {
              "$ref": "#/$defs/Instant"
            },
            {
              "type": "null"
            }
          ]
        },
        "checklistKey": {
          "type": ["string", "null"]
        }
      },
      "required": [
        "id",
        "scanId",
        "criterion",
        "result",
        "notes",
        "evidence",
        "checkedBy",
        "checkedAt",
        "checklistKey"
      ],
      "additionalProperties": false
    },
    "ResidualRisk": {
      "type": "object",
      "properties": {
        "rating": {
          "type": "string",
          "enum": ["high", "medium", "low"]
        },
        "reasons": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "unresolved_critical",
              "wcag21_does_not_support",
              "unresolved_serious",
              "wcag21_partially_supports",
              "wcag21_manual_review_pending",
              "wcag22_new_criteria_gaps",
              "pending_verification"
            ]
          }
        },
        "unresolved": {
          "type": "object",
          "properties": {
            "critical": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "serious": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "moderate": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "minor": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": ["critical", "serious", "moderate", "minor"],
          "additionalProperties": false
        },
        "pendingVerification": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "criteria": {
          "type": "object",
          "properties": {
            "wcag21aa": {
              "$ref": "#/$defs/CriteriaByLevel"
            },
            "wcag22aa": {
              "$ref": "#/$defs/CriteriaByLevel"
            }
          },
          "required": ["wcag21aa", "wcag22aa"],
          "additionalProperties": false
        }
      },
      "required": ["rating", "reasons", "unresolved", "pendingVerification", "criteria"],
      "additionalProperties": false,
      "description": "Section 6: residual risk; the rating rule is in docs/adr/004-evidence-package.md."
    },
    "CriteriaByLevel": {
      "type": "object",
      "properties": {
        "doesNotSupport": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WcagCriterion"
          }
        },
        "partiallySupports": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WcagCriterion"
          }
        },
        "notEvaluated": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WcagCriterion"
          }
        },
        "awaitingManualReview": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WcagCriterion"
          }
        }
      },
      "required": ["doesNotSupport", "partiallySupports", "notEvaluated", "awaitingManualReview"],
      "additionalProperties": false
    },
    "Recommendation": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "fix_critical_serious",
            "merge_delivered_fixes",
            "run_verification_scan",
            "fix_moderate_minor",
            "complete_manual_review",
            "expert_review_uncovered",
            "revisit_wontfix",
            "prepare_wcag22",
            "enable_regression_protection",
            "keep_regression_protection",
            "review_annually"
          ]
        },
        "priority": {
          "anyOf": [
            {
              "type": "number",
              "const": 1
            },
            {
              "type": "number",
              "const": 2
            },
            {
              "type": "number",
              "const": 3
            }
          ]
        },
        "findingIds": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Uuid"
          }
        },
        "criteria": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WcagCriterion"
          }
        }
      },
      "required": ["code", "priority", "findingIds", "criteria"],
      "additionalProperties": false
    },
    "Schedule": {
      "type": "object",
      "properties": {
        "nextVerificationDue": {
          "$ref": "#/$defs/Instant"
        },
        "nextVerificationReason": {
          "type": "string",
          "enum": ["pending_work", "periodic_review"]
        },
        "nextMonitoringRun": {
          "anyOf": [
            {
              "$ref": "#/$defs/Instant"
            },
            {
              "type": "null"
            }
          ]
        },
        "monitoring": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "cadence": {
                  "type": "string",
                  "enum": ["weekly", "monthly"]
                },
                "timeZone": {
                  "type": "string"
                },
                "lastRunAt": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/Instant"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": ["cadence", "timeZone", "lastRunAt"],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "nextVerificationDue",
        "nextVerificationReason",
        "nextMonitoringRun",
        "monitoring"
      ],
      "additionalProperties": false
    },
    "StatementInputs": {
      "type": "object",
      "properties": {
        "organizationName": {
          "type": "string"
        },
        "country": {
          "type": ["string", "null"]
        },
        "siteName": {
          "type": "string"
        },
        "siteUrl": {
          "type": "string",
          "format": "uri"
        },
        "preparedAt": {
          "$ref": "#/$defs/Instant"
        },
        "evaluation": {
          "type": "object",
          "properties": {
            "method": {
              "type": "string",
              "const": "third_party"
            },
            "evaluator": {
              "type": "string"
            },
            "scanFinishedAt": {
              "$ref": "#/$defs/Instant"
            },
            "verificationFinishedAt": {
              "anyOf": [
                {
                  "$ref": "#/$defs/Instant"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": ["method", "evaluator", "scanFinishedAt", "verificationFinishedAt"],
          "additionalProperties": false
        },
        "legalReference": {
          "type": "object",
          "properties": {
            "en301549": {
              "type": "string"
            },
            "wcag": {
              "$ref": "#/$defs/WcagVersion"
            }
          },
          "required": ["en301549", "wcag"],
          "additionalProperties": false
        },
        "upcomingReference": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "en301549": {
                  "type": "string"
                },
                "wcag": {
                  "$ref": "#/$defs/WcagVersion"
                },
                "citedInOJEU": {
                  "type": "boolean"
                }
              },
              "required": ["en301549", "wcag", "citedInOJEU"],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "wcag21aa": {
          "$ref": "#/$defs/StatementTarget"
        },
        "wcag22aa": {
          "$ref": "#/$defs/StatementTarget"
        },
        "nextReviewDue": {
          "$ref": "#/$defs/Instant"
        }
      },
      "required": [
        "organizationName",
        "country",
        "siteName",
        "siteUrl",
        "preparedAt",
        "evaluation",
        "legalReference",
        "upcomingReference",
        "wcag21aa",
        "wcag22aa",
        "nextReviewDue"
      ],
      "additionalProperties": false,
      "description": "Section 7: what the draft accessibility statement (EU model structure) needs."
    },
    "StatementTarget": {
      "type": "object",
      "properties": {
        "compliance": {
          "type": "string",
          "enum": ["full", "partial", "none"]
        },
        "nonCompliant": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "criterion": {
                "$ref": "#/$defs/WcagCriterion"
              },
              "conformance": {
                "type": "string",
                "enum": ["does_not_support", "partially_supports"]
              },
              "findingIds": {
                "type": "array",
                "items": {
                  "$ref": "#/$defs/Uuid"
                }
              },
              "maxImpact": {
                "anyOf": [
                  {
                    "$ref": "#/$defs/Impact"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": ["criterion", "conformance", "findingIds", "maxImpact"],
            "additionalProperties": false
          }
        },
        "notEvaluated": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WcagCriterion"
          }
        }
      },
      "required": ["compliance", "nonCompliant", "notEvaluated"],
      "additionalProperties": false
    }
  }
}
