{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://grcengclub.com/acq/acq.schema.json",
  "title": "Anti-Checkbox Questionnaire (ACQ) response",
  "description": "What an organization publishes: a GEC maturity level per control backed by answers and evidence, plus baseline check results. tools/validate_acq.py applies the rules JSON Schema cannot express.",
  "type": "object",
  "required": ["acqVersion", "gecVersion", "organization", "published", "assurance", "scope", "controls", "baseline"],
  "additionalProperties": false,
  "properties": {
    "$schema": { "type": "string" },
    "acqVersion": { "type": "string", "description": "ACQ version answered, e.g. 0.1.0." },
    "gecVersion": { "type": "string", "description": "GEC version the levels were scored against." },
    "organization": {
      "type": "object",
      "required": ["name", "website", "contact"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string" },
        "website": { "type": "string", "format": "uri" },
        "contact": { "type": "string", "description": "Security or trust contact (email or URL)." }
      }
    },
    "published": { "type": "string", "format": "date" },
    "assurance": {
      "enum": ["attested", "evidenced", "continuous"],
      "description": "attested: answers with a named owner. evidenced: answers link to system-generated evidence. continuous: evidence regenerated on a schedule; lastVerified required."
    },
    "lastVerified": { "type": "string", "format": "date" },
    "validatedBy": {
      "type": "array",
      "description": "Optional. Independent parties (auditors, assessors, scanning providers) that validated this ACQ. Each hosts its own report on its own domain; the ACQ links to it.",
      "items": {
        "type": "object",
        "required": ["name", "website", "reportUrl", "date"],
        "additionalProperties": false,
        "properties": {
          "name": { "type": "string", "minLength": 1, "description": "The validating organization." },
          "website": { "type": "string", "format": "uri", "description": "The validator's own website." },
          "reportUrl": { "type": "string", "format": "uri", "pattern": "^https://", "description": "The validator's report, hosted on the validator's own domain." },
          "date": { "type": "string", "format": "date", "description": "Date of the validation." },
          "covers": { "type": "string", "description": "What was validated, e.g. 'Baseline results for AWS and GitHub'." }
        }
      }
    },
    "scope": {
      "type": "object",
      "required": ["description", "platforms"],
      "additionalProperties": false,
      "properties": {
        "description": { "type": "string" },
        "platforms": {
          "type": "array",
          "items": { "enum": ["aws", "azure", "gcp", "github", "google_workspace", "m365_entra", "okta"] },
          "uniqueItems": true
        },
        "otherPlatforms": { "type": "array", "items": { "type": "string" } }
      }
    },
    "controls": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "level", "owner", "answers"],
        "additionalProperties": false,
        "properties": {
          "id": { "type": "string", "pattern": "^GEC-[0-9]{2}$" },
          "level": { "type": "integer", "minimum": 1, "maximum": 5 },
          "owner": { "type": "string", "description": "Accountable role, e.g. 'Head of Platform'." },
          "gaps": { "type": "string", "description": "Known coverage gaps. Partial coverage scores at the weakest in-scope system." },
          "answers": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["question", "answer"],
              "additionalProperties": false,
              "properties": {
                "question": { "type": "string", "pattern": "^ACQ-[0-9]{2}\\.[0-9]+$" },
                "answer": { "type": "string", "minLength": 1 },
                "evidence": { "type": "array", "items": { "$ref": "#/$defs/evidence" } }
              }
            }
          }
        }
      }
    },
    "baseline": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "result"],
        "additionalProperties": false,
        "properties": {
          "id": { "type": "string", "pattern": "^ACQ-B[0-9]{2}$" },
          "result": { "enum": ["pass", "fail", "exception", "not-applicable"] },
          "platforms": { "type": "array", "items": { "type": "string" } },
          "checkedAt": { "type": "string", "format": "date-time" },
          "tool": { "type": "string", "description": "What produced the result, e.g. a scanner name and version." },
          "exception": {
            "type": "object",
            "required": ["reason", "expires"],
            "additionalProperties": false,
            "properties": {
              "reason": { "type": "string" },
              "expires": { "type": "string", "format": "date" }
            }
          },
          "evidence": { "type": "array", "items": { "$ref": "#/$defs/evidence" } }
        }
      }
    }
  },
  "$defs": {
    "evidence": {
      "type": "object",
      "required": ["description"],
      "additionalProperties": false,
      "properties": {
        "description": { "type": "string" },
        "url": { "type": "string", "description": "Public link, or omit and mark confidential." },
        "confidential": { "type": "boolean", "description": "Available to customers under NDA, not linked publicly." },
        "generatedBy": { "type": "string", "description": "System or tool that produced it. Omit for hand-made evidence." },
        "date": { "type": "string", "format": "date" }
      }
    }
  }
}
