{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://permit.agiscorecard.com/input.schema.json",
  "title": "Data Permit input structure",
  "description": "Structural contract. The engine additionally validates ranges, dates, amounts, uniqueness and cross-field constraints; passing this schema is not a complete validation.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "use",
    "region",
    "asOf",
    "currency",
    "receivedRevenue",
    "datasets"
  ],
  "properties": {
    "use": {
      "type": "string",
      "enum": [
        "training",
        "inference",
        "evaluation",
        "redistribution"
      ]
    },
    "region": {
      "type": "string"
    },
    "asOf": {
      "type": "string"
    },
    "currency": {
      "type": "string"
    },
    "receivedRevenue": {
      "type": "string"
    },
    "datasets": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "source",
          "license",
          "allowedUses",
          "regions",
          "expires",
          "personalData",
          "consent",
          "revoked",
          "shareBps"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "license": {
            "type": "string"
          },
          "allowedUses": {
            "type": "string"
          },
          "regions": {
            "type": "string"
          },
          "expires": {
            "type": "string"
          },
          "personalData": {
            "type": "boolean"
          },
          "consent": {
            "type": "string",
            "enum": [
              "recorded",
              "unknown",
              "not-required"
            ]
          },
          "revoked": {
            "type": "boolean"
          },
          "shareBps": {
            "type": "number"
          }
        }
      }
    }
  }
}
