{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nopaque-co-uk/json-schema/nopaque-co-uk-update-path-rule-request-schema.json",
  "title": "UpdatePathRuleRequest",
  "description": "Request body for `PATCH /mapping/{id}/paths/{path}`. At least one of `state`,\n`config`, `menuDurationMs`, or `repeatConfig` must be present. Pass `null` for\nany nullable field to clear it.\n",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nopaque-co-uk-mapping-api-openapi.yml#/components/schemas/UpdatePathRuleRequest",
  "type": "object",
  "properties": {
    "state": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "remap",
        "exclude"
      ],
      "description": "`remap` schedules the path for re-discovery (deletes the step and its children).\n`exclude` skips the path on the next run. `null` clears any existing state.\n"
    },
    "config": {
      "oneOf": [
        {
          "$ref": "#/$defs/PathConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Scripted input config, or `null` to clear."
    },
    "menuDurationMs": {
      "type": "integer",
      "minimum": 1,
      "description": "Cached menu duration to override on this path."
    },
    "repeatConfig": {
      "oneOf": [
        {
          "$ref": "#/$defs/RepeatConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Per-path repeat override, or `null` to clear."
    }
  },
  "$defs": {
    "PathConfig": {
      "type": "object",
      "description": "Scripted input configuration for a specific path (PIN entry, voice utterance, etc.).",
      "required": [
        "inputType",
        "data"
      ],
      "properties": {
        "inputType": {
          "type": "string",
          "enum": [
            "pin",
            "voice",
            "audio",
            "dtmf_sequence",
            "profile_data"
          ],
          "description": "Type of scripted input to apply when navigating this path."
        },
        "data": {
          "type": "string",
          "description": "Input payload — PIN digits, voice utterance, S3 URL for audio, etc."
        },
        "profileItemId": {
          "type": "string",
          "format": "uuid",
          "description": "Profile item id when `inputType` is `profile_data`."
        },
        "terminator": {
          "type": "string",
          "description": "Key to press after input (e.g. `#`)."
        },
        "waitForPrompt": {
          "type": "boolean",
          "description": "Whether to wait for the prompt before sending input."
        }
      }
    },
    "RepeatConfig": {
      "type": "object",
      "description": "Repeat-detection configuration. Controls how the orchestrator handles\nsituations where a discovered menu is revisited via a different DTMF path\n(a loop). `skip` ignores the revisit entirely; `explore_once` explores it\nthe first time only; `explore_n` explores up to `maxExplorations` times.\n",
      "required": [
        "behavior"
      ],
      "properties": {
        "behavior": {
          "type": "string",
          "enum": [
            "skip",
            "explore_once",
            "explore_n"
          ],
          "description": "Behaviour when a repeated menu is detected."
        },
        "maxExplorations": {
          "type": "integer",
          "minimum": 1,
          "maximum": 10,
          "description": "Maximum explorations when `behavior` is `explore_n` (default 2)."
        }
      }
    }
  }
}