{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://howmuchai.net/schema/ai-disclosure-0.1.schema.json",
  "title": "AI disclosure for a video game (ai-disclosure/0.1)",
  "description": "Says where and how generative AI was used in a game. Served by How Much AI or published by a developer at /.well-known/ai-disclosure.json. One game per file, or several under a top-level \"games\" array.",
  "oneOf": [
    {
      "title": "Single game",
      "type": "object",
      "required": [
        "spec",
        "game",
        "declared_at",
        "categories",
        "runtime"
      ],
      "additionalProperties": false,
      "properties": {
        "spec": {
          "$ref": "#/$defs/spec"
        },
        "game": {
          "$ref": "#/$defs/game"
        },
        "declared_at": {
          "$ref": "#/$defs/date"
        },
        "categories": {
          "$ref": "#/$defs/categories"
        },
        "runtime": {
          "$ref": "#/$defs/runtime"
        },
        "tools": {
          "$ref": "#/$defs/tools"
        },
        "note": {
          "$ref": "#/$defs/globalNote"
        }
      }
    },
    {
      "title": "Several games on one domain",
      "type": "object",
      "required": [
        "spec",
        "games"
      ],
      "additionalProperties": false,
      "properties": {
        "spec": {
          "$ref": "#/$defs/spec"
        },
        "games": {
          "type": "array",
          "minItems": 1,
          "maxItems": 200,
          "items": {
            "$ref": "#/$defs/entry"
          }
        }
      }
    }
  ],
  "$defs": {
    "spec": {
      "const": "ai-disclosure/0.1"
    },
    "date": {
      "description": "Calendar date, YYYY-MM-DD",
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
    },
    "entry": {
      "type": "object",
      "required": [
        "game",
        "declared_at",
        "categories",
        "runtime"
      ],
      "additionalProperties": false,
      "properties": {
        "game": {
          "$ref": "#/$defs/game"
        },
        "declared_at": {
          "$ref": "#/$defs/date"
        },
        "categories": {
          "$ref": "#/$defs/categories"
        },
        "runtime": {
          "$ref": "#/$defs/runtime"
        },
        "tools": {
          "$ref": "#/$defs/tools"
        },
        "note": {
          "$ref": "#/$defs/globalNote"
        }
      }
    },
    "game": {
      "type": "object",
      "required": [
        "title",
        "platforms"
      ],
      "additionalProperties": false,
      "properties": {
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "platforms": {
          "description": "At least one store id, used to link the disclosure to a store page",
          "type": "object",
          "minProperties": 1,
          "additionalProperties": false,
          "properties": {
            "steam": {
              "description": "Steam AppID",
              "type": "integer",
              "minimum": 1
            },
            "itch": {
              "description": "itch.io user/slug",
              "type": "string",
              "pattern": "^[a-z0-9_-]+/[a-z0-9_-]+$"
            }
          }
        },
        "version": {
          "type": "string",
          "minLength": 1,
          "maxLength": 50
        },
        "developer": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      }
    },
    "level": {
      "enum": [
        "none",
        "assisted",
        "generated_edited",
        "generated",
        "unknown",
        "not_applicable"
      ]
    },
    "category": {
      "type": "object",
      "required": [
        "level"
      ],
      "additionalProperties": false,
      "properties": {
        "level": {
          "$ref": "#/$defs/level"
        },
        "share": {
          "enum": [
            "few",
            "some",
            "most"
          ]
        },
        "note": {
          "type": "string",
          "maxLength": 200
        }
      },
      "if": {
        "required": [
          "share"
        ]
      },
      "then": {
        "properties": {
          "level": {
            "enum": [
              "assisted",
              "generated_edited",
              "generated"
            ]
          }
        }
      }
    },
    "categories": {
      "description": "All 7 categories are required: a missing one is refused, never assumed \"none\"",
      "type": "object",
      "required": [
        "visuals",
        "audio",
        "voice",
        "writing",
        "localization",
        "code",
        "marketing"
      ],
      "additionalProperties": false,
      "properties": {
        "visuals": {
          "$ref": "#/$defs/category"
        },
        "audio": {
          "$ref": "#/$defs/category"
        },
        "voice": {
          "$ref": "#/$defs/category"
        },
        "writing": {
          "$ref": "#/$defs/category"
        },
        "localization": {
          "$ref": "#/$defs/category"
        },
        "code": {
          "$ref": "#/$defs/category"
        },
        "marketing": {
          "$ref": "#/$defs/category"
        }
      }
    },
    "runtime": {
      "description": "Content generated by AI while the player plays",
      "type": "object",
      "required": [
        "uses_ai"
      ],
      "additionalProperties": false,
      "properties": {
        "uses_ai": {
          "type": "boolean"
        },
        "description": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      },
      "if": {
        "properties": {
          "uses_ai": {
            "const": true
          }
        }
      },
      "then": {
        "required": [
          "description"
        ]
      }
    },
    "tools": {
      "type": "array",
      "maxItems": 20,
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 60
      }
    },
    "globalNote": {
      "type": "string",
      "maxLength": 500
    }
  }
}