{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://axis.efeonce.org/contracts/candidate/ai-search-intent.v1.schema.json",
  "title": "AXIS creative AI search composition intent · candidate v1",
  "description": "Editable graphic reference. Google Search AI Mode and Efeonce exploration remain distinct surfaces; this does not execute a search.",
  "type": "object",
  "additionalProperties": false,
  "required": ["contract", "surface", "theme", "state", "query", "provenance", "modules"],
  "properties": {
    "contract": { "const": "efeonce.ai-search-graphic.candidate.v1" },
    "surface": { "enum": ["google-search-ai-mode", "efeonce-exploration"] },
    "theme": { "enum": ["light", "dark"] },
    "state": { "enum": ["idle", "focused", "query-filled", "suggestions-open", "suggestion-active", "submitting", "error"] },
    "query": { "type": "string", "maxLength": 180 },
    "placeholder": { "type": "string", "maxLength": 30 },
    "aiActionLabel": { "type": "string", "minLength": 1, "maxLength": 18 },
    "suggestions": {
      "type": "array", "maxItems": 5, "uniqueItems": true,
      "items": { "type": "object", "additionalProperties": false, "required": ["id", "text"], "properties": { "id": { "type": "string", "pattern": "^[a-z0-9-]+$" }, "text": { "type": "string", "minLength": 1, "maxLength": 60 } } }
    },
    "activeSuggestionId": { "type": "string" },
    "targetSuggestionId": { "type": "string" },
    "modules": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "enum": ["full", "field", "action", "icon", "suggestions", "suggestion"] } },
    "format": { "enum": ["natural", "4x5", "9x16", "16x9"] },
    "provenance": {
      "oneOf": [
        { "type": "object", "additionalProperties": false, "required": ["mode"], "properties": { "mode": { "const": "editorial-sample" } } },
        { "type": "object", "additionalProperties": false, "required": ["mode", "reference", "capturedAt"], "properties": { "mode": { "const": "captured-output" }, "reference": { "type": "string", "minLength": 1 }, "capturedAt": { "type": "string", "format": "date" } } }
      ]
    }
  },
  "allOf": [
    { "if": { "properties": { "surface": { "const": "google-search-ai-mode" } } }, "then": { "properties": { "state": { "enum": ["idle", "focused", "query-filled", "submitting", "error"] }, "suggestions": { "maxItems": 0 }, "modules": { "items": { "enum": ["full", "field", "action", "icon"] } }, "aiActionLabel": { "const": "Modo IA" } } } },
    { "if": { "properties": { "state": { "const": "suggestion-active" } } }, "then": { "required": ["activeSuggestionId"] } },
    { "if": { "properties": { "state": { "enum": ["query-filled", "submitting"] } } }, "then": { "properties": { "query": { "minLength": 1 } } } }
  ]
}
