{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lune/json-schema/lune-order-quote-by-quantity-schema.json",
  "title": "OrderQuoteByQuantity",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lune-orders-api-openapi.yml#/components/schemas/OrderQuoteByQuantity",
  "allOf": [
    {
      "$ref": "#/$defs/OrderQuoteBase"
    },
    {
      "type": "object",
      "required": [
        "requested_quantity",
        "requested_value"
      ],
      "properties": {
        "requested_quantity": {
          "type": "string",
          "pattern": "^[0-9]+(\\.[0-9]+)?$",
          "description": "Requested quantity for the specific bundle (tonnes CO2).\n\nrequested_quantity may be returned as part of an emission estimate response, in which case this property contains the equivalent value as the `mass` property.\n"
        },
        "requested_value": {
          "description": "Requested value of CO2 offsets to purchase in the account's currency.",
          "type": [
            "string",
            "null"
          ],
          "pattern": "^[0-9]+(\\.[0-9]+)?$"
        }
      }
    }
  ],
  "$defs": {
    "OrderBundle": {
      "type": "object",
      "required": [
        "bundle_id",
        "bundle_name",
        "quantity",
        "unit_price",
        "gross_unit_price",
        "offset_cost",
        "insufficient_available_quantity"
      ],
      "properties": {
        "bundle_id": {
          "type": "string",
          "description": "The bundle's unique identifier"
        },
        "bundle_name": {
          "type": "string",
          "description": "The bundle's name"
        },
        "primary_image": {
          "type": "string",
          "description": "A bundle's image URL"
        },
        "quantity": {
          "type": "string",
          "pattern": "^[0-9]+(\\.[0-9]+)?$",
          "description": "Quantity for the specific bundle (tonnes CO2)"
        },
        "unit_price": {
          "type": "string",
          "description": "Bundle unit price per tonne CO2\n\nUnit: order currency\n",
          "pattern": "^[0-9]+(\\.[0-9]+)?$"
        },
        "gross_unit_price": {
          "type": "string",
          "description": "Bundle unit price per tonne CO2 inclusive of fees.\n\nUnit: order currency\n",
          "pattern": "^[0-9]+(\\.[0-9]+)?$"
        },
        "offset_cost": {
          "type": "string",
          "description": "The bundle's net offset cost being purchased.\n\nUnit: order currency\n",
          "pattern": "^[0-9]+(\\.[0-9]+)?$"
        },
        "insufficient_available_quantity": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "If true, there is no inventory necessary to fully satisfy the order for this bundle.\n"
        }
      }
    },
    "OrderQuoteBase": {
      "type": "object",
      "required": [
        "currency",
        "estimated_quantity",
        "estimated_commission",
        "estimated_offset_cost",
        "estimated_total_cost",
        "bundles"
      ],
      "properties": {
        "currency": {
          "type": "string",
          "description": "Currency code"
        },
        "estimated_quantity": {
          "type": "string",
          "pattern": "^[0-9]+(\\.[0-9]+)?$",
          "description": "Estimated quantity (tonnes CO2).\n\nMay be lower than `requested_quantity`.\n"
        },
        "estimated_offset_cost": {
          "type": "string",
          "description": "Estimated offset cost\n\nUnit: order quote currency\n",
          "pattern": "^[0-9]+(\\.[0-9]+)?$"
        },
        "estimated_total_cost": {
          "type": "string",
          "description": "Estimated total cost inclusive of Lune fees.\n\nUnit: order quote currency\n",
          "pattern": "^[0-9]+(\\.[0-9]+)?$"
        },
        "estimated_commission": {
          "type": "string",
          "description": "Estimated commission",
          "pattern": "^[0-9]+(\\.[0-9]+)?$"
        },
        "bundles": {
          "type": "array",
          "description": "Bundles included in the quote including quantity and cost breakdown.\n",
          "items": {
            "$ref": "#/$defs/OrderBundle"
          }
        }
      }
    }
  }
}