{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schema": {
      "type": "string",
      "const": "skillflux-source-audit/v1"
    },
    "siteSlug": {
      "type": "string",
      "minLength": 1
    },
    "auditedAt": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "checkerVersion": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$"
    },
    "method": {
      "type": "string",
      "enum": [
        "repo",
        "list"
      ]
    },
    "listing": {
      "type": "object",
      "properties": {
        "repo": {
          "type": "string",
          "pattern": "^https:\\/\\/github\\.com\\/[^/]+\\/[^/]+$"
        },
        "commitSha": {
          "type": "string",
          "pattern": "^[0-9a-f]{40}$"
        },
        "candidates": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "repo",
        "commitSha",
        "candidates"
      ],
      "additionalProperties": false
    },
    "sample": {
      "type": "object",
      "properties": {
        "seed": {
          "type": "string",
          "minLength": 1
        },
        "requested": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "seed",
        "requested"
      ],
      "additionalProperties": false
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "repo": {
            "type": "string",
            "pattern": "^https:\\/\\/github\\.com\\/[^/]+\\/[^/]+$"
          },
          "linkedPath": {
            "type": [
              "string",
              "null"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "checked",
              "no-skill",
              "unreachable"
            ]
          },
          "commitSha": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9a-f]{40}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "path": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "counts": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "pass": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "warn": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "fail": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "info": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "pass",
                  "warn",
                  "fail",
                  "info"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "flags": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "executes-code",
                "network-calls",
                "destructive-commands",
                "risky-instructions",
                "possible-secret",
                "no-license",
                "stale",
                "archived-repo",
                "upstream-changed"
              ]
            }
          },
          "statuses": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string",
              "enum": [
                "pass",
                "warn",
                "fail",
                "info"
              ]
            }
          },
          "scriptCount": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "bodyTokensApprox": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "licenseSpdx": {
            "type": [
              "string",
              "null"
            ]
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "repo",
          "linkedPath",
          "outcome",
          "commitSha",
          "path",
          "name",
          "counts",
          "flags",
          "statuses",
          "scriptCount",
          "bodyTokensApprox",
          "licenseSpdx",
          "detail"
        ],
        "additionalProperties": false
      }
    },
    "summary": {
      "type": "object",
      "properties": {
        "sampled": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "checked": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "noSkill": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "unreachable": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "withScripts": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "networkCalls": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "destructiveCommands": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "noLicense": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "missingTrigger": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "overTokenBudget": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "failingAnyCheck": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "stale": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "sampled",
        "checked",
        "noSkill",
        "unreachable",
        "withScripts",
        "networkCalls",
        "destructiveCommands",
        "noLicense",
        "missingTrigger",
        "overTokenBudget",
        "failingAnyCheck",
        "stale"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "schema",
    "siteSlug",
    "auditedAt",
    "checkerVersion",
    "method",
    "listing",
    "sample",
    "items",
    "summary"
  ],
  "additionalProperties": false
}
