{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pikasim-com/json-schema/pikasim-com-package-list-response-schema.json",
  "title": "PackageListResponse",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pikasim-com-openapi.yaml#/components/schemas/PackageListResponse",
  "type": "object",
  "required": [
    "success",
    "packages"
  ],
  "properties": {
    "success": {
      "type": "boolean",
      "description": "Whether the request was successful"
    },
    "packages": {
      "type": "array",
      "description": "Array of eSIM packages",
      "items": {
        "$ref": "#/$defs/Package"
      }
    }
  },
  "$defs": {
    "Package": {
      "type": "object",
      "required": [
        "packageCode",
        "name",
        "region",
        "location",
        "volume",
        "duration",
        "price",
        "isGlobalPackage"
      ],
      "properties": {
        "packageCode": {
          "type": "string",
          "description": "Unique package identifier (use this for purchases)"
        },
        "name": {
          "type": "string",
          "description": "Human-readable package name"
        },
        "region": {
          "type": "string",
          "description": "Geographic region or country name"
        },
        "location": {
          "type": "string",
          "description": "ISO country code or region identifier"
        },
        "locationCode": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO country code for single-country packages (e.g., \"MA\" for Morocco). Null for regional/global packages."
        },
        "volume": {
          "type": "integer",
          "format": "int64",
          "description": "Data volume in bytes (binary). Convert to GiB: `volume / (1024 * 1024 * 1024)`\n\nCommon values:\n- 1073741824 bytes = 1.0 GiB (displayed as \"1GB\")\n- 3221225472 bytes = 3.0 GiB (displayed as \"3GB\")\n\nNote: Industry standard uses binary GiB but markets as \"GB\" for simplicity.\n"
        },
        "volumeGB": {
          "type": "number",
          "description": "Data volume in GB (pre-calculated from bytes for convenience)."
        },
        "duration": {
          "type": "integer",
          "description": "For fixed plans (dataType=1): Validity period in days.\nFor Unlimited Daily plans (dataType=2): This is the reset period (always 1). Use `validityDays` instead.\n"
        },
        "dataType": {
          "type": "integer",
          "description": "Package type indicator:\n- 1 = Fixed data pool (use until exhausted within duration)\n- 2 = **Unlimited Daily** (daily high-speed reset with Fair Usage Policy)\n\n**Recommended**: Use the `isUnlimited` boolean field instead of checking dataType.\n",
          "enum": [
            1,
            2
          ]
        },
        "isUnlimited": {
          "type": "boolean",
          "description": "**true** if this is an Unlimited Daily plan (dataType=2).\nUse this instead of checking dataType directly.\n"
        },
        "validityDays": {
          "type": "integer",
          "description": "Total validity period in days.\nFor Unlimited plans, this is the actual validity (e.g., 180 days), not the reset period.\nFor fixed plans, this equals `duration`.\n"
        },
        "dailyDataGB": {
          "type": [
            "number",
            "null"
          ],
          "description": "For Unlimited plans only: daily high-speed data allowance in GB.\nNull for fixed plans.\n"
        },
        "fupMbps": {
          "type": [
            "number",
            "null"
          ],
          "description": "Fair Usage Policy speed limit in Mbps after daily data exhausted.\nPopulated for every per-day (unlimited) plan; fractional for\nsub-Mbps throttles (e.g. 384 Kbps → 0.38). Null on fixed plans\nwith no throttle.\n"
        },
        "pricingType": {
          "type": "string",
          "enum": [
            "fixed",
            "per_day"
          ],
          "description": "**CRITICAL FOR PRICING**:\n- `\"fixed\"` = Price is total for the package\n- `\"per_day\"` = Price is the DAILY rate (multiply by days, then apply duration discount)\n\nFor `per_day` plans (Unlimited Daily), use `purchasableDurations` for\nexact checkout totals per purchasable duration.\n"
        },
        "price": {
          "type": "integer",
          "description": "Price in micro-dollars. **Display**: `displayPrice = price / 10000`\n\n**IMPORTANT**: Check `pricingType` first!\n- For `pricingType: \"fixed\"` → This is the total price\n- For `pricingType: \"per_day\"` → This is the DAILY rate\n\nExamples:\n- price 180000 → $18.00\n- price 56000 with pricingType \"per_day\" → $5.60/day\n"
        },
        "priceUSD": {
          "type": "number",
          "description": "Price in USD (pre-calculated from micro-dollars).\nFor `pricingType: \"per_day\"`, this is the daily rate.\n"
        },
        "purchasableDays": {
          "type": [
            "array",
            "null"
          ],
          "description": "For `per_day` plans only: the exact day counts purchasable at checkout.\nNull for `fixed` plans. This is the source of truth for which unlimited\ndurations we sell — it changes automatically if we add or drop one.\n",
          "items": {
            "type": "integer"
          }
        },
        "purchasableDurations": {
          "type": [
            "array",
            "null"
          ],
          "description": "For `per_day` plans only: one priced entry per purchasable duration.\n`price_display` is the exact total checkout would charge, in the\nrequested currency, computed by the same code path checkout uses.\nNull for `fixed` plans. Prefer this over `examplePrices`.\n",
          "items": {
            "type": "object",
            "properties": {
              "days": {
                "type": "integer"
              },
              "price_display": {
                "type": "number"
              },
              "discountPercent": {
                "type": "number"
              }
            }
          }
        },
        "examplePrices": {
          "type": [
            "object",
            "null"
          ],
          "deprecated": true,
          "description": "DEPRECATED — use `purchasableDurations`. For `per_day` plans only:\npre-calculated totals for 7 and 30 days. The former `14_days` key was\nremoved because 14 days is not a purchasable duration.\nNull for `fixed` plans.\n",
          "properties": {
            "7_days": {
              "type": "number",
              "description": "Total price for 7 days (8% discount applied)"
            },
            "30_days": {
              "type": "number",
              "description": "Total price for 30 days (18% discount applied)"
            }
          }
        },
        "durationDiscounts": {
          "type": [
            "object",
            "null"
          ],
          "description": "For `per_day` plans only: discount tiers by trip duration.\nNull for `fixed` plans.\n",
          "properties": {
            "1-4_days": {
              "type": "string"
            },
            "5-9_days": {
              "type": "string"
            },
            "10-19_days": {
              "type": "string"
            },
            "20-29_days": {
              "type": "string"
            },
            "30+_days": {
              "type": "string"
            }
          }
        },
        "isGlobalPackage": {
          "type": "boolean",
          "description": "Whether this package works in 120+ countries (true) or specific country/region (false)"
        }
      }
    }
  }
}