{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tenantpilot.local/contracts/inventory-coverage-rbac.schema.json",
  "title": "Inventory Coverage RBAC Foundation Extension",
  "type": "object",
  "additionalProperties": false,
  "required": ["foundation_types"],
  "properties": {
    "foundation_types": {
      "type": "object",
      "additionalProperties": false,
      "required": ["intuneRoleDefinition", "intuneRoleAssignment"],
      "properties": {
        "intuneRoleDefinition": {
          "$ref": "#/$defs/coverageRow"
        },
        "intuneRoleAssignment": {
          "$ref": "#/$defs/coverageRow"
        }
      }
    }
  },
  "$defs": {
    "coverageRow": {
      "type": "object",
      "additionalProperties": false,
      "required": ["status"],
      "properties": {
        "status": {
          "type": "string",
          "enum": ["succeeded", "failed", "skipped"]
        },
        "item_count": {
          "type": "integer",
          "minimum": 0
        },
        "error_code": {
          "type": ["string", "null"]
        }
      }
    }
  }
}