{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ucp.dev/2026-04-08/schemas/service.json",
  "title": "UCP Service",
  "description": "Service binding for a specific transport. Each transport binding is a separate entry in the service array.",
  "$defs": {
    "base": {
      "allOf": [
        {
          "$ref": "https://ucp.dev/2026-04-08/schemas/ucp.json#/$defs/entity"
        },
        {
          "type": "object",
          "required": [
            "transport"
          ],
          "properties": {
            "transport": {
              "type": "string",
              "enum": [
                "rest",
                "mcp",
                "a2a",
                "embedded"
              ],
              "description": "Transport protocol for this service binding."
            },
            "endpoint": {
              "type": "string",
              "format": "uri",
              "description": "Endpoint URL for this transport binding."
            }
          }
        }
      ]
    },
    "platform_schema": {
      "title": "Service (Platform Schema)",
      "description": "Full service declaration for platform-level discovery. All transports require `version`, `spec`, and `transport`. REST and MCP additionally require `schema` and `endpoint`; A2A requires `endpoint`; embedded requires `schema`.",
      "allOf": [
        {
          "$ref": "#/$defs/base"
        },
        {
          "required": [
            "spec"
          ]
        },
        {
          "anyOf": [
            {
              "properties": {
                "transport": {
                  "const": "rest"
                }
              },
              "required": [
                "schema",
                "endpoint"
              ]
            },
            {
              "properties": {
                "transport": {
                  "const": "mcp"
                }
              },
              "required": [
                "schema",
                "endpoint"
              ]
            },
            {
              "properties": {
                "transport": {
                  "const": "a2a"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            {
              "properties": {
                "transport": {
                  "const": "embedded"
                }
              },
              "required": [
                "schema"
              ]
            }
          ]
        }
      ]
    },
    "business_schema": {
      "title": "Service (Business Schema)",
      "description": "Service binding for business/merchant configuration. May override platform endpoints.",
      "allOf": [
        {
          "$ref": "#/$defs/base"
        },
        {
          "anyOf": [
            {
              "properties": {
                "transport": {
                  "const": "rest"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            {
              "properties": {
                "transport": {
                  "const": "mcp"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            {
              "properties": {
                "transport": {
                  "const": "a2a"
                }
              },
              "required": [
                "endpoint"
              ]
            },
            {
              "properties": {
                "transport": {
                  "const": "embedded"
                },
                "config": {
                  "$ref": "https://ucp.dev/2026-04-08/schemas/transports/embedded_config.json"
                }
              }
            }
          ]
        }
      ]
    },
    "response_schema": {
      "title": "Service (Response Schema)",
      "description": "Service binding in API responses. Includes per-resource transport configuration via typed config.",
      "allOf": [
        {
          "$ref": "#/$defs/base"
        },
        {
          "anyOf": [
            {
              "properties": {
                "transport": {
                  "const": "rest"
                }
              }
            },
            {
              "properties": {
                "transport": {
                  "const": "mcp"
                }
              }
            },
            {
              "properties": {
                "transport": {
                  "const": "a2a"
                }
              }
            },
            {
              "properties": {
                "transport": {
                  "const": "embedded"
                },
                "config": {
                  "$ref": "https://ucp.dev/2026-04-08/schemas/transports/embedded_config.json"
                }
              }
            }
          ]
        }
      ]
    }
  }
}