{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/transit/json-schema/transit-microtransit-leg-schema.json",
  "title": "MicrotransitLeg",
  "description": "Leg used for microtransit",
  "x-generated": "2026-12-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/transit-v4-api-openapi.yml#/components/schemas/MicrotransitLeg",
  "type": "object",
  "properties": {
    "leg_mode": {
      "type": "string",
      "enum": [
        "microtransit"
      ],
      "description": "The mode of the current leg. In a microtransit leg, it will always be 'microtransit'. "
    },
    "start_time": {
      "type": "integer",
      "description": "The expected start time in unix time"
    },
    "end_time": {
      "type": "integer",
      "description": "The expected end time in unix time"
    },
    "duration": {
      "type": "integer",
      "description": "Travel duration in seconds"
    },
    "products": {
      "type": "array",
      "description": "The microtransit products that can be used to travel this leg.",
      "items": {
        "type": "object",
        "properties": {
          "product_price": {
            "type": "object",
            "description": "The object specifing the price of the microtransit leg. Pricing details are not always available.",
            "properties": {
              "type": {
                "type": "string",
                "description": "The type of princing. Possible values are\n - 'Metered': the pricing is based on a meter inside the vehicle\n - 'Price': the pricing is defined in the `low_price` and `high_price` values in the pricing object.\n",
                "enum": [
                  "Metered",
                  "Price"
                ]
              },
              "low_price": {
                "$ref": "#/$defs/Price",
                "description": "Lower possible price of the trip, can be null if not avaialble. "
              },
              "high_price": {
                "$ref": "#/$defs/Price",
                "description": "Higher possible price of the trip, can be null if not avaialble. "
              }
            },
            "required": [
              "type"
            ]
          },
          "product_id": {
            "type": "string",
            "description": "Unique identifier of the microtransit product"
          },
          "product_name": {
            "type": "string",
            "description": "Refers to the product name of the microtransit service. Usually, for microtransit, the product and service names are the same. However, they might differ if one microtransit provider offers multiple services under different brand names (for instance, one service using vans and another using cars)."
          },
          "product_service_name": {
            "type": "string",
            "description": "Refers to the service name of the microtransit service. Usually, for microtransit, the product and service names are the same. However, they might differ if one microtransit provider offers multiple services under different brand names (for instance, one service using vans and another using cars)."
          },
          "product_color": {
            "type": "string",
            "description": "Hex-encoded color that should be used to represent the product. "
          },
          "product_text_color": {
            "type": "string",
            "description": "Hex-encoded text color to use when product_color is the background color."
          },
          "product_logo_image": {
            "type": "string"
          },
          "product_icon_image": {
            "type": "string"
          }
        },
        "required": [
          "product_price",
          "product_id",
          "product_name",
          "product_service_name",
          "product_color",
          "product_text_color",
          "product_logo_image",
          "product_icon_image"
        ]
      }
    }
  },
  "required": [
    "leg_mode",
    "start_time",
    "end_time",
    "duration",
    "products"
  ],
  "$defs": {
    "Price": {
      "type": "object",
      "title": "Price",
      "properties": {
        "currency_code": {
          "type": "string",
          "description": "ISO 4217 currency code"
        },
        "symbol": {
          "type": "string",
          "description": "Currency symbol"
        },
        "text": {
          "type": "string",
          "description": "Formatted price with value and currency symbol"
        },
        "value": {
          "type": "number",
          "description": "Price value as a float"
        }
      },
      "required": [
        "currency_code",
        "symbol",
        "text",
        "value"
      ]
    }
  }
}