{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lune/json-schema/lune-aggregated-analytics-by-property-schema.json",
  "title": "AggregatedAnalyticsByProperty",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lune-openapi.yml#/components/schemas/AggregatedAnalyticsByProperty",
  "type": "object",
  "required": [
    "bundle",
    "location",
    "registry",
    "oxford_offsetting_principles",
    "offset_type"
  ],
  "properties": {
    "bundle": {
      "type": "array",
      "description": "An array of objects describing a bundle's aggregated orders.",
      "items": {
        "type": "object",
        "required": [
          "bundle_id",
          "bundle_name",
          "quantity",
          "value"
        ],
        "properties": {
          "bundle_id": {
            "type": "string",
            "description": "The bundle's unique identifier."
          },
          "bundle_name": {
            "type": "string",
            "description": "The bundle's name."
          },
          "quantity": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]+)?$",
            "description": "Quantity of CO2 offsets linked to this activity (tonnes CO2)."
          },
          "value": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]+)?$",
            "description": "CO2 offsets' monetary value."
          }
        }
      }
    },
    "location": {
      "type": "array",
      "description": "An array of objects describing a location's aggregated orders.",
      "items": {
        "type": "object",
        "required": [
          "location",
          "quantity",
          "value"
        ],
        "properties": {
          "location": {
            "type": "string",
            "description": "Project location (continent). If a project has yet to be assigned 'Not yet allocated' is returned instead."
          },
          "quantity": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]+)?$",
            "description": "Quantity of CO2 offsets linked to this activity (tonnes CO2)."
          },
          "value": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]+)?$",
            "description": "CO2 offsets' monetary value"
          }
        }
      }
    },
    "registry": {
      "type": "array",
      "description": "An array of objects describing a registry's aggregated orders.",
      "items": {
        "type": "object",
        "required": [
          "registry_name",
          "quantity",
          "value"
        ],
        "properties": {
          "registry_name": {
            "oneOf": [
              {
                "x-lune-name": "Actual registry",
                "$ref": "#/$defs/Registry"
              },
              {
                "x-lune-name": "Special value",
                "type": "string",
                "enum": [
                  "Not certified",
                  "Not yet allocated"
                ]
              }
            ],
            "description": "The project's Verification Standard Entity name or equivalent organization. If a project has no registry, 'Not certified' is returned. If a project has yet to be assigned, 'Not yet allocated' is returned."
          },
          "quantity": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]+)?$",
            "description": "Quantity of CO2 offsets linked to this activity (tonnes CO2)."
          },
          "value": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]+)?$",
            "description": "CO2 offsets' monetary value."
          }
        }
      }
    },
    "oxford_offsetting_principles": {
      "type": "array",
      "description": "An array of objects describing aggregated orders for each Oxford Offsetting Principle's type.",
      "items": {
        "type": "object",
        "required": [
          "type",
          "quantity",
          "value"
        ],
        "properties": {
          "type": {
            "type": "number",
            "description": "Oxford Offsetting Principles' type.\n\nhttps://lune.co/blog/the-oxford-offsetting-principles-a-framework-to-maximise-the-impact-of-business-carbon-offsetting/.\n",
            "minimum": 1,
            "maximum": 5
          },
          "quantity": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]+)?$",
            "description": "Quantity of CO2 offsets linked to this activity (tonnes CO2)"
          },
          "value": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]+)?$",
            "description": "CO2 offsets' monetary value"
          }
        }
      }
    },
    "offset_type": {
      "type": "array",
      "description": "An array of objects describing aggregated orders by offset type.",
      "items": {
        "type": "object",
        "required": [
          "offset_type",
          "quantity",
          "value"
        ],
        "properties": {
          "offset_type": {
            "$ref": "#/$defs/OffsetType"
          },
          "quantity": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]+)?$",
            "description": "Quantity of CO2 offsets linked to this activity (tonnes CO2)"
          },
          "value": {
            "type": "string",
            "pattern": "^[0-9]+(\\.[0-9]+)?$",
            "description": "CO2 offsets' monetary value"
          }
        }
      }
    }
  },
  "$defs": {
    "NullEnum": {
      "type": [
        "string",
        "null"
      ],
      "x-lune-name": "Null",
      "description": "The property is set to `null`.",
      "enum": [
        null
      ]
    },
    "OffsetType": {
      "description": "Offset type classification\n",
      "oneOf": [
        {
          "$ref": "#/$defs/OffsetTypeNonNullable"
        },
        {
          "$ref": "#/$defs/NullEnum"
        }
      ]
    },
    "OffsetTypeNonNullable": {
      "type": "string",
      "description": "Offset type classification\n",
      "enum": [
        "emissions_reduction",
        "carbon_removal"
      ]
    },
    "Registry": {
      "type": "string",
      "description": "The project's Verification Standard Entity name or equivalent organization.",
      "enum": [
        "American Carbon Registry",
        "Verra",
        "Puro.earth",
        "Gold Standard",
        "Climate Action Reserve",
        "Woodland Carbon Code",
        "ACCU",
        "Carbon Future",
        "Isometric",
        "Tuv Nord",
        ""
      ]
    }
  }
}