{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://autoagentprotocol.org/v3.0/schemas/aap-extension-params.schema.json",
  "title": "AapExtensionParams",
  "description": "AAP 3.0 metadata carried in the A2A Agent Card extension params. Links the three bindings without inventing an A2A transport or a PAP conversation protocol.",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Stable deployment identifier. It must not identify a shopper."
    },
    "version": {
      "const": "3.0.0"
    },
    "schema_base_url": {
      "const": "https://autoagentprotocol.org/v3.0/schemas/"
    },
    "mcp": {
      "$ref": "./mcp-endpoint.schema.json"
    },
    "poppy": {
      "type": "string",
      "format": "uri",
      "pattern": "^[Hh][Tt][Tt][Pp][Ss]://[^/?#@\\s]+(?:/[^?#\\s]*)?$"
    },
    "llms_txt": {
      "type": "string",
      "format": "uri",
      "pattern": "^[Hh][Tt][Tt][Pp][Ss]://[^/?#@\\s]+(?:/[^?#\\s]*)?$"
    },
    "skills": {
      "type": "object",
      "minProperties": 1,
      "properties": {
        "dealer.information": {
          "type": "object",
          "properties": {
            "request_schema": {
              "const": "https://autoagentprotocol.org/v3.0/schemas/dealer-information-request.schema.json"
            },
            "response_schema": {
              "const": "https://autoagentprotocol.org/v3.0/schemas/dealer-information-response.schema.json"
            }
          },
          "required": [
            "request_schema",
            "response_schema"
          ],
          "additionalProperties": true
        },
        "inventory.facets": {
          "type": "object",
          "properties": {
            "request_schema": {
              "const": "https://autoagentprotocol.org/v3.0/schemas/inventory-facets-request.schema.json"
            },
            "response_schema": {
              "const": "https://autoagentprotocol.org/v3.0/schemas/inventory-facets-response.schema.json"
            }
          },
          "required": [
            "request_schema",
            "response_schema"
          ],
          "additionalProperties": true
        },
        "inventory.search": {
          "type": "object",
          "properties": {
            "request_schema": {
              "const": "https://autoagentprotocol.org/v3.0/schemas/inventory-search-request.schema.json"
            },
            "response_schema": {
              "const": "https://autoagentprotocol.org/v3.0/schemas/inventory-search-response.schema.json"
            },
            "capabilities": {
              "$ref": "./inventory-capabilities.schema.json"
            }
          },
          "required": [
            "request_schema",
            "response_schema",
            "capabilities"
          ],
          "additionalProperties": true
        },
        "inventory.vehicle": {
          "type": "object",
          "properties": {
            "request_schema": {
              "const": "https://autoagentprotocol.org/v3.0/schemas/vehicle-detail-request.schema.json"
            },
            "response_schema": {
              "const": "https://autoagentprotocol.org/v3.0/schemas/vehicle-detail-response.schema.json"
            }
          },
          "required": [
            "request_schema",
            "response_schema"
          ],
          "additionalProperties": true
        },
        "lead.submit": {
          "type": "object",
          "properties": {
            "request_schema": {
              "const": "https://autoagentprotocol.org/v3.0/schemas/lead-submit-request.schema.json"
            },
            "response_schema": {
              "const": "https://autoagentprotocol.org/v3.0/schemas/lead-submit-response.schema.json"
            }
          },
          "required": [
            "request_schema",
            "response_schema"
          ],
          "additionalProperties": true
        }
      },
      "additionalProperties": false
    }
  },
  "required": [
    "id",
    "version",
    "schema_base_url",
    "mcp",
    "poppy",
    "llms_txt",
    "skills"
  ],
  "allOf": [
    {
      "if": {
        "properties": {
          "skills": {
            "properties": {
              "inventory.search": {
                "properties": {
                  "capabilities": {
                    "properties": {
                      "filters": {
                        "contains": {
                          "enum": [
                            "features_all",
                            "features_any"
                          ]
                        }
                      }
                    },
                    "required": [
                      "filters"
                    ]
                  }
                },
                "required": [
                  "capabilities"
                ]
              }
            },
            "required": [
              "inventory.search"
            ]
          }
        },
        "required": [
          "skills"
        ]
      },
      "then": {
        "properties": {
          "skills": {
            "required": [
              "inventory.facets"
            ]
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "skills": {
            "properties": {
              "inventory.search": {
                "properties": {
                  "capabilities": {
                    "properties": {
                      "scope": {
                        "const": "aggregate"
                      }
                    },
                    "required": [
                      "scope"
                    ]
                  }
                },
                "required": [
                  "capabilities"
                ]
              }
            },
            "required": [
              "inventory.search"
            ]
          }
        },
        "required": [
          "skills"
        ]
      },
      "then": {
        "properties": {
          "skills": {
            "required": [
              "dealer.information"
            ]
          }
        }
      }
    }
  ],
  "additionalProperties": true
}
