{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "spec-first verification profile contract",
  "description": "Source-owned verification profile contract. It declares service stacks and check command identities for workflow closeout; it does not execute checks or decide verification status.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "default_profile",
    "profiles",
    "services",
    "stacks"
  ],
  "properties": {
    "schema_version": { "type": "string", "const": "verification-profile.v1" },
    "default_profile": { "type": "string", "minLength": 1, "maxLength": 80 },
    "profiles": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "required": ["services", "checks"],
        "properties": {
          "services": {
            "type": "array",
            "minItems": 1,
            "items": { "type": "string", "minLength": 1, "maxLength": 80 }
          },
          "checks": {
            "type": "array",
            "minItems": 1,
            "items": { "type": "string", "minLength": 1, "maxLength": 80 }
          }
        }
      }
    },
    "services": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "required": ["path", "stack", "required"],
        "properties": {
          "path": {
            "type": "string",
            "pattern": "^(\\.|(?!/)(?![A-Za-z]:[\\\\/])(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.\\.?(?:/|$)).+[^/])$"
          },
          "stack": { "type": "string", "minLength": 1, "maxLength": 80 },
          "required": { "type": "boolean" }
        }
      }
    },
    "stacks": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "required": ["detect", "commands", "runner_kind", "required_tools"],
        "properties": {
          "detect": {
            "type": "array",
            "items": { "type": "string", "minLength": 1, "maxLength": 160 }
          },
          "commands": {
            "type": "object",
            "additionalProperties": { "type": "string", "minLength": 1, "maxLength": 500 }
          },
          "runner_kind": {
            "type": "object",
            "additionalProperties": { "type": "string", "minLength": 1, "maxLength": 80 }
          },
          "required_tools": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": { "type": "string", "minLength": 1, "maxLength": 80 }
            }
          }
        }
      }
    }
  }
}
