{
  "$schema": "http://json-schema.org/draft-06/schema#",
  "title": "Refund Event Fields Schema",
  "description": "Defines the event fields our system recognizes as a refund event",
  "type": "object",
  "properties": {
    "order_id": {
      "title": "Refunded Order ID",
      "description": "The order or transaction ID associated with the refunded purchase",
      "type": "string",
      "maxLength": 375
    },
    "affiliation": {
      "type": "string",
      "title": "Affiliation",
      "description": "Store or affiliation from which this transaction occurred (e.g. Google Store)",
      "maxLength": 375
    },
    "total": {
      "title": "Refunded Total",
      "type": "number",
      "minimum": 0,
      "description": "Revenue with discounts and coupons added in"
    },
    "revenue": {
      "title": "Refunded Revenue",
      "type": "number",
      "minimum": 0,
      "description": "Revenue associated with the transaction (excluding shipping and tax). This is the field we use to calculate a customer's LTV."
    },
    "shipping": {
      "title": "Refunded Shipping",
      "type": "number",
      "minimum": 0,
      "description": "Shipping cost associated with the transaction"
    },
    "tax": {
      "title": "Refunded Tax",
      "type": "number",
      "minimum": 0,
      "description": "Total tax associated with the transaction"
    },
    "currency": {
      "title": "Refunded Currency",
      "type": "string",
      "description": "The ISO currency code used in this purchase",
      "pattern": "^[A-Z]{3}$"
    },
    "products": {
      "title": "Refunded Products",
      "type": "array",
      "maxItems": 200,
      "items": {
        "type": "object",
        "properties": {
          "product_id": {
            "type": "string",
            "title": "Product ID",
            "description": "Database id of the product being viewed",
            "maxLength": 375
          },
          "sku": {
            "type": "string",
            "title": "Stock Keeping Unit",
            "description": "Sku of the product being viewed",
            "maxLength": 375
          },
          "category": {
            "type": "string",
            "title": "Product Category",
            "description": "Product category being viewed",
            "maxLength": 375
          },
          "name": {
            "type": "string",
            "title": "Product Name",
            "description": "Name of the product being viewed",
            "maxLength": 375
          },
          "brand": {
            "type": "string",
            "title": "Brand",
            "description": "Brand associated with the product",
            "maxLength": 375
          },
          "variant": {
            "type": "string",
            "title": "Product Variant",
            "description": "Variant of the product (e.g. Black)",
            "maxLength": 375
          },
          "price": {
            "type": "number",
            "title": "Price",
            "description": "Price of the product being viewed",
            "minimum": 0
          },
          "quantity": {
            "type": "integer",
            "title": "Quantity",
            "description": "Quantity of a product",
            "minimum": 0
          },
          "coupon": {
            "type": "string",
            "title": "Coupon",
            "description": "Coupon code associated with a product (e.g MAY_DEALS_3)",
            "maxLength": 375
          },
          "position": {
            "type": "integer",
            "title": "Product Position",
            "description": "Position in the product list (ex. 3)"
          },
          "url": {
            "type": "string",
            "title": "Product URL",
            "description": "URL of the product page",
            "maxLength": 375
          },
          "image_url": {
            "type": "string",
            "title": "Image URL",
            "description": "Image url of the product",
            "maxLength": 375
          }
        },
        "required": [
          "product_id"
        ],
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}