{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tenantatlas.local/schemas/action-surface-declaration.schema.json",
  "title": "ActionSurfaceDeclaration",
  "type": "object",
  "additionalProperties": false,
  "required": ["version", "componentType", "profile", "defaults", "slots"],
  "properties": {
    "version": {
      "type": "integer",
      "minimum": 1
    },
    "componentType": {
      "type": "string",
      "enum": ["Resource", "Page", "RelationManager"]
    },
    "profile": {
      "type": "string",
      "enum": [
        "CrudListAndEdit",
        "CrudListAndView",
        "ListOnlyReadOnly",
        "RunLog"
      ]
    },
    "defaults": {
      "type": "object",
      "additionalProperties": false,
      "required": ["moreGroupLabel"],
      "properties": {
        "moreGroupLabel": {
          "type": "string",
          "const": "More"
        },
        "exportIsDefaultBulkActionForReadOnly": {
          "type": "boolean"
        }
      }
    },
    "slots": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "ListHeader": { "$ref": "#/$defs/slotRequirement" },
        "ListRowPrimary": { "$ref": "#/$defs/slotRequirement" },
        "ListRowMoreMenu": { "$ref": "#/$defs/slotRequirement" },
        "ListBulkMoreGroup": { "$ref": "#/$defs/slotRequirement" },
        "ListEmptyState": { "$ref": "#/$defs/slotRequirement" },
        "DetailHeader": { "$ref": "#/$defs/slotRequirement" }
      }
    },
    "exemptions": {
      "type": "array",
      "items": { "$ref": "#/$defs/exemption" }
    }
  },
  "$defs": {
    "slotRequirement": {
      "type": "object",
      "additionalProperties": false,
      "required": ["status"],
      "properties": {
        "status": {
          "type": "string",
          "enum": ["Satisfied", "Exempt"]
        },
        "details": {
          "type": "string"
        },
        "requiresTypedConfirmation": {
          "type": "boolean",
          "default": false
        }
      }
    },
    "exemption": {
      "type": "object",
      "additionalProperties": false,
      "required": ["slot", "reason"],
      "properties": {
        "slot": {
          "type": "string",
          "enum": [
            "ListHeader",
            "ListRowPrimary",
            "ListRowMoreMenu",
            "ListBulkMoreGroup",
            "ListEmptyState",
            "DetailHeader"
          ]
        },
        "reason": {
          "type": "string",
          "minLength": 1
        },
        "trackingRef": {
          "type": "string"
        }
      }
    }
  }
}
