{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/compsniper-com/json-schema/compsniper-com-shipping-rate-response-schema.json",
  "title": "ShippingRateResponse",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/compsniper-com-openapi.json#/components/schemas/ShippingRateResponse",
  "type": "object",
  "required": [
    "source",
    "rateType",
    "currency",
    "totalRates",
    "totalConditionalRates",
    "fetchedAt",
    "validUntil",
    "requestId",
    "rates",
    "conditionalRates"
  ],
  "properties": {
    "source": {
      "type": "string",
      "enum": [
        "ebay_shipping_calculator"
      ]
    },
    "rateType": {
      "type": "string",
      "enum": [
        "estimate"
      ]
    },
    "currency": {
      "type": "string"
    },
    "totalRates": {
      "type": "integer",
      "minimum": 1,
      "description": "Services currently applicable to the submitted package and content declarations."
    },
    "totalConditionalRates": {
      "type": "integer",
      "minimum": 0,
      "description": "Additional services requiring specific carrier packaging or eligible contents."
    },
    "fetchedAt": {
      "type": "string",
      "format": "date-time"
    },
    "validUntil": {
      "type": "string",
      "format": "date-time"
    },
    "requestId": {
      "type": "string",
      "format": "uuid"
    },
    "rates": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/ShippingRate"
      }
    },
    "conditionalRates": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ShippingRate"
      }
    }
  },
  "$defs": {
    "ShippingPrice": {
      "type": "object",
      "required": [
        "min",
        "max",
        "currency"
      ],
      "properties": {
        "min": {
          "type": "string"
        },
        "max": {
          "type": [
            "string",
            "null"
          ]
        },
        "currency": {
          "type": "string"
        }
      }
    },
    "ShippingRate": {
      "type": "object",
      "required": [
        "carrierCode",
        "serviceName",
        "serviceCode",
        "serviceGroup",
        "tracking",
        "estimatedDeliveryMinHours",
        "estimatedDeliveryMaxHours",
        "includedCoverage",
        "fastest",
        "discountedPrice",
        "retailPrice",
        "effectivePrice",
        "priceSource",
        "savingsPercent",
        "eligibility"
      ],
      "properties": {
        "carrierCode": {
          "type": "string"
        },
        "serviceName": {
          "type": "string"
        },
        "serviceCode": {
          "type": "string"
        },
        "serviceGroup": {
          "type": [
            "string",
            "null"
          ]
        },
        "tracking": {
          "type": "boolean"
        },
        "estimatedDeliveryMinHours": {
          "type": [
            "integer",
            "null"
          ]
        },
        "estimatedDeliveryMaxHours": {
          "type": [
            "integer",
            "null"
          ]
        },
        "includedCoverage": {
          "type": [
            "string",
            "null"
          ]
        },
        "fastest": {
          "type": "boolean",
          "description": "True when this applicable service has the shortest maximum delivery window. Ties are allowed."
        },
        "discountedPrice": {
          "type": [
            "object",
            "null"
          ],
          "allOf": [
            {
              "$ref": "#/$defs/ShippingPrice"
            }
          ]
        },
        "retailPrice": {
          "$ref": "#/$defs/ShippingPrice"
        },
        "effectivePrice": {
          "$ref": "#/$defs/ShippingPrice"
        },
        "priceSource": {
          "type": "string",
          "enum": [
            "ebay_discounted",
            "retail"
          ]
        },
        "savingsPercent": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "eligibility": {
          "type": "object",
          "required": [
            "status",
            "requirements"
          ],
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "eligible",
                "conditional"
              ]
            },
            "requirements": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "type",
                  "code",
                  "message"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "carrier_packaging",
                      "eligible_contents"
                    ]
                  },
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}