{
    "openapi": "3.0.3",
    "info": {
        "title": "eSIMDual Reseller API",
        "version": "1.0.0",
        "description": "REST API for reseller authentication, catalog access, orders, eSIM management, wallet data, and webhook events. Authenticate with a Bearer token returned by POST /login. All amounts are returned as decimal numbers. The Idempotency-Key header is supported on POST /orders to prevent duplicate purchases."
    },
    "servers": [
        {
            "url": "https://esimdual.com/api/reseller/v1",
            "description": "Primary API"
        }
    ],
    "tags": [
        {
            "name": "System",
            "description": "Health and API availability checks."
        },
        {
            "name": "Auth",
            "description": "Reseller authentication and profile endpoints."
        },
        {
            "name": "Catalog",
            "description": "Pricing and package catalog endpoints."
        },
        {
            "name": "Orders",
            "description": "Order creation and retrieval."
        },
        {
            "name": "eSIMs",
            "description": "Purchased eSIM resources and usage."
        },
        {
            "name": "Wallet",
            "description": "Wallet balance and transaction history."
        },
        {
            "name": "Webhooks",
            "description": "Outbound webhook payloads sent by eSIMDual."
        }
    ],
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "Sanctum"
            }
        },
        "parameters": {
            "IdempotencyKey": {
                "name": "Idempotency-Key",
                "in": "header",
                "required": false,
                "schema": {
                    "type": "string",
                    "maxLength": 255
                },
                "description": "Unique key used to safely retry order creation without creating duplicate purchases."
            }
        },
        "schemas": {
            "SuccessEnvelope": {
                "type": "object",
                "required": [
                    "status",
                    "message"
                ],
                "properties": {
                    "status": {
                        "type": "boolean",
                        "example": true
                    },
                    "message": {
                        "type": "string",
                        "example": "Success"
                    }
                }
            },
            "ErrorEnvelope": {
                "type": "object",
                "required": [
                    "status",
                    "message"
                ],
                "properties": {
                    "status": {
                        "type": "boolean",
                        "example": false
                    },
                    "message": {
                        "type": "string",
                        "example": "Invalid login details"
                    },
                    "errors": {
                        "type": "object",
                        "additionalProperties": true
                    }
                }
            },
            "LoginRequest": {
                "type": "object",
                "required": [
                    "email",
                    "password"
                ],
                "properties": {
                    "email": {
                        "type": "string",
                        "format": "email",
                        "example": "partner@example.com"
                    },
                    "password": {
                        "type": "string",
                        "format": "password",
                        "example": "StrongPassword123!"
                    },
                    "device_name": {
                        "type": "string",
                        "example": "noanet-production"
                    }
                }
            },
            "ResellerUser": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 3
                    },
                    "name": {
                        "type": "string",
                        "example": "NoaNet"
                    },
                    "email": {
                        "type": "string",
                        "format": "email",
                        "example": "partner@example.com"
                    },
                    "balance": {
                        "type": "number",
                        "format": "float",
                        "example": 250
                    },
                    "currency": {
                        "type": "string",
                        "example": "USD"
                    },
                    "brand_name": {
                        "type": "string",
                        "nullable": true,
                        "example": "NoaNet"
                    },
                    "domain": {
                        "type": "string",
                        "nullable": true,
                        "example": "https://noanet.example"
                    }
                }
            },
            "LoginResponse": {
                "type": "object",
                "required": [
                    "status",
                    "access_token",
                    "token_type",
                    "user"
                ],
                "properties": {
                    "status": {
                        "type": "boolean",
                        "example": true
                    },
                    "access_token": {
                        "type": "string",
                        "example": "1|long-sanctum-token"
                    },
                    "token_type": {
                        "type": "string",
                        "example": "Bearer"
                    },
                    "user": {
                        "$ref": "#/components/schemas/ResellerUser"
                    }
                }
            },
            "Country": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 75
                    },
                    "name": {
                        "type": "string",
                        "example": "France"
                    },
                    "code": {
                        "type": "string",
                        "example": "fr"
                    },
                    "slug": {
                        "type": "string",
                        "nullable": true,
                        "example": "france"
                    }
                }
            },
            "Region": {
                "type": "object",
                "nullable": true,
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 4
                    },
                    "name": {
                        "type": "string",
                        "example": "Europe"
                    },
                    "slug": {
                        "type": "string",
                        "example": "europe"
                    }
                }
            },
            "Provider": {
                "type": "object",
                "nullable": true,
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 1
                    },
                    "name": {
                        "type": "string",
                        "example": "eSIMCard"
                    },
                    "slug": {
                        "type": "string",
                        "example": "esimcard"
                    }
                }
            },
            "PricingQuote": {
                "type": "object",
                "properties": {
                    "base_cost": {
                        "type": "number",
                        "format": "float",
                        "example": 3.5
                    },
                    "markup_type": {
                        "type": "string",
                        "example": "percent"
                    },
                    "markup_value": {
                        "type": "number",
                        "format": "float",
                        "example": 20
                    },
                    "profit_amount": {
                        "type": "number",
                        "format": "float",
                        "example": 0.7
                    },
                    "reseller_price": {
                        "type": "number",
                        "format": "float",
                        "example": 4.2
                    },
                    "currency": {
                        "type": "string",
                        "example": "USD"
                    }
                }
            },
            "Package": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 1120
                    },
                    "provider_plan_id": {
                        "type": "string",
                        "nullable": true,
                        "example": "FR-5GB-30D"
                    },
                    "name": {
                        "type": "string",
                        "example": "France 5 GB - 30 Days"
                    },
                    "slug": {
                        "type": "string",
                        "nullable": true,
                        "example": "france-5gb-30-days"
                    },
                    "package_type": {
                        "type": "string",
                        "example": "DATA"
                    },
                    "data_quantity": {
                        "type": "number",
                        "example": 5
                    },
                    "data_unit": {
                        "type": "string",
                        "example": "GB"
                    },
                    "data_volume": {
                        "type": "integer",
                        "example": 5368709120
                    },
                    "voice_quantity": {
                        "type": "integer",
                        "example": 0
                    },
                    "sms_quantity": {
                        "type": "integer",
                        "example": 0
                    },
                    "package_validity": {
                        "type": "integer",
                        "example": 30
                    },
                    "package_validity_unit": {
                        "type": "string",
                        "example": "Day"
                    },
                    "network_speed": {
                        "type": "string",
                        "nullable": true,
                        "example": "5G"
                    },
                    "reloadable": {
                        "type": "boolean",
                        "example": true
                    },
                    "area_coverage": {
                        "type": "string",
                        "nullable": true,
                        "example": "Local"
                    },
                    "region": {
                        "$ref": "#/components/schemas/Region"
                    },
                    "countries": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Country"
                        }
                    },
                    "provider": {
                        "$ref": "#/components/schemas/Provider"
                    },
                    "pricing": {
                        "$ref": "#/components/schemas/PricingQuote"
                    }
                }
            },
            "PricingCountry": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string",
                        "example": "France"
                    },
                    "code": {
                        "type": "string",
                        "example": "fr"
                    },
                    "packages": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer",
                                    "example": 1120
                                },
                                "name": {
                                    "type": "string",
                                    "example": "France 5 GB - 30 Days"
                                },
                                "price": {
                                    "type": "string",
                                    "example": "4.20"
                                },
                                "currency": {
                                    "type": "string",
                                    "example": "USD"
                                },
                                "data_quantity": {
                                    "type": "number",
                                    "example": 5
                                },
                                "data_unit": {
                                    "type": "string",
                                    "example": "GB"
                                },
                                "package_validity": {
                                    "type": "integer",
                                    "example": 30
                                },
                                "package_validity_unit": {
                                    "type": "string",
                                    "example": "Day"
                                }
                            }
                        }
                    }
                }
            },
            "OrderCreateRequest": {
                "type": "object",
                "required": [
                    "package_id"
                ],
                "properties": {
                    "package_id": {
                        "type": "integer",
                        "example": 1120
                    },
                    "device_imei": {
                        "type": "string",
                        "nullable": true,
                        "example": "356938035643809"
                    },
                    "external_order_id": {
                        "type": "string",
                        "nullable": true,
                        "example": "NOANET-20260315-0001"
                    }
                }
            },
            "Order": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 45
                    },
                    "external_order_id": {
                        "type": "string",
                        "nullable": true,
                        "example": "NOANET-20260315-0001"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "pending",
                            "processing",
                            "completed",
                            "failed"
                        ],
                        "example": "completed"
                    },
                    "currency": {
                        "type": "string",
                        "example": "USD"
                    },
                    "price": {
                        "type": "number",
                        "format": "float",
                        "example": 4.2
                    },
                    "provider_cost": {
                        "type": "number",
                        "format": "float",
                        "example": 3.5
                    },
                    "profit_amount": {
                        "type": "number",
                        "format": "float",
                        "example": 0.7
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "package": {
                        "type": "object",
                        "nullable": true,
                        "properties": {
                            "id": {
                                "type": "integer",
                                "example": 1120
                            },
                            "provider_plan_id": {
                                "type": "string",
                                "nullable": true,
                                "example": "FR-5GB-30D"
                            },
                            "name": {
                                "type": "string",
                                "example": "France 5 GB - 30 Days"
                            }
                        }
                    },
                    "esim": {
                        "type": "object",
                        "nullable": true,
                        "properties": {
                            "id": {
                                "type": "integer",
                                "example": 108
                            },
                            "iccid": {
                                "type": "string",
                                "nullable": true,
                                "example": "8988207000000000001"
                            },
                            "serial_number": {
                                "type": "string",
                                "nullable": true,
                                "example": "SIM-100001"
                            },
                            "qr_code": {
                                "type": "string",
                                "nullable": true,
                                "example": "LPA:1$example.com$CODE"
                            },
                            "qr_code_image": {
                                "type": "string",
                                "nullable": true,
                                "example": "https://cdn.example.com/qr.png"
                            },
                            "phone_number": {
                                "type": "string",
                                "nullable": true,
                                "example": "+33600000000"
                            },
                            "expiry_date": {
                                "type": "string",
                                "nullable": true,
                                "format": "date",
                                "example": "2026-04-14"
                            }
                        }
                    },
                    "provider_response": {
                        "type": "object",
                        "nullable": true,
                        "additionalProperties": true
                    }
                }
            },
            "Esim": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 108
                    },
                    "serial_number": {
                        "type": "string",
                        "nullable": true,
                        "example": "SIM-100001"
                    },
                    "iccid": {
                        "type": "string",
                        "nullable": true,
                        "example": "8988207000000000001"
                    },
                    "phone_number": {
                        "type": "string",
                        "nullable": true,
                        "example": "+33600000000"
                    },
                    "qr_code": {
                        "type": "string",
                        "nullable": true,
                        "example": "LPA:1$example.com$CODE"
                    },
                    "qr_code_image": {
                        "type": "string",
                        "nullable": true,
                        "example": "https://cdn.example.com/qr.png"
                    },
                    "provider_status": {
                        "type": "string",
                        "nullable": true,
                        "example": "ACTIVE"
                    },
                    "expiry_date": {
                        "type": "string",
                        "nullable": true,
                        "format": "date",
                        "example": "2026-04-14"
                    },
                    "activated_at": {
                        "type": "string",
                        "nullable": true,
                        "format": "date-time"
                    },
                    "installed_at": {
                        "type": "string",
                        "nullable": true,
                        "format": "date-time"
                    },
                    "provider_expiry_at": {
                        "type": "string",
                        "nullable": true,
                        "format": "date-time"
                    },
                    "package": {
                        "type": "object",
                        "nullable": true,
                        "properties": {
                            "id": {
                                "type": "integer",
                                "example": 1120
                            },
                            "provider_plan_id": {
                                "type": "string",
                                "nullable": true,
                                "example": "FR-5GB-30D"
                            },
                            "name": {
                                "type": "string",
                                "example": "France 5 GB - 30 Days"
                            }
                        }
                    }
                }
            },
            "Usage": {
                "type": "object",
                "additionalProperties": true,
                "example": {
                    "total": "5 GB",
                    "remaining": "3.2 GB",
                    "used": "1.8 GB",
                    "expiry_date": "2026-04-14"
                }
            },
            "WalletTransaction": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "example": 501
                    },
                    "type": {
                        "type": "string",
                        "example": "debit"
                    },
                    "amount": {
                        "type": "number",
                        "format": "float",
                        "example": 4.2
                    },
                    "currency": {
                        "type": "string",
                        "example": "USD"
                    },
                    "post_balance": {
                        "type": "number",
                        "format": "float",
                        "example": 245.8
                    },
                    "reference": {
                        "type": "string",
                        "nullable": true,
                        "example": "ABCD12345678"
                    },
                    "description": {
                        "type": "string",
                        "nullable": true,
                        "example": "eSIM order payment"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            },
            "Wallet": {
                "type": "object",
                "properties": {
                    "balance": {
                        "type": "number",
                        "format": "float",
                        "example": 245.8
                    },
                    "currency": {
                        "type": "string",
                        "example": "USD"
                    },
                    "transactions": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/WalletTransaction"
                        }
                    }
                }
            },
            "WebhookPing": {
                "type": "object",
                "properties": {
                    "event": {
                        "type": "string",
                        "example": "ping"
                    },
                    "message": {
                        "type": "string",
                        "example": "eSIMDual webhook test"
                    },
                    "occurred_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "reseller_id": {
                        "type": "integer",
                        "example": 3
                    }
                }
            },
            "WebhookOrderEvent": {
                "type": "object",
                "properties": {
                    "event": {
                        "type": "string",
                        "example": "order.completed"
                    },
                    "occurred_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "order": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer",
                                "example": 45
                            },
                            "external_order_id": {
                                "type": "string",
                                "nullable": true,
                                "example": "NOANET-20260315-0001"
                            },
                            "status": {
                                "type": "string",
                                "example": "completed"
                            },
                            "currency": {
                                "type": "string",
                                "example": "USD"
                            },
                            "price": {
                                "type": "number",
                                "format": "float",
                                "example": 4.2
                            },
                            "provider_cost": {
                                "type": "number",
                                "format": "float",
                                "example": 3.5
                            },
                            "profit_amount": {
                                "type": "number",
                                "format": "float",
                                "example": 0.7
                            },
                            "created_at": {
                                "type": "string",
                                "format": "date-time"
                            }
                        }
                    },
                    "package": {
                        "type": "object",
                        "nullable": true,
                        "properties": {
                            "id": {
                                "type": "integer",
                                "example": 1120
                            },
                            "provider_plan_id": {
                                "type": "string",
                                "nullable": true,
                                "example": "FR-5GB-30D"
                            },
                            "name": {
                                "type": "string",
                                "example": "France 5 GB - 30 Days"
                            },
                            "slug": {
                                "type": "string",
                                "nullable": true,
                                "example": "france-5gb-30-days"
                            }
                        }
                    },
                    "esim": {
                        "type": "object",
                        "nullable": true,
                        "properties": {
                            "id": {
                                "type": "integer",
                                "example": 108
                            },
                            "iccid": {
                                "type": "string",
                                "nullable": true,
                                "example": "8988207000000000001"
                            },
                            "serial_number": {
                                "type": "string",
                                "nullable": true,
                                "example": "SIM-100001"
                            },
                            "qr_code": {
                                "type": "string",
                                "nullable": true,
                                "example": "LPA:1$example.com$CODE"
                            },
                            "qr_code_image": {
                                "type": "string",
                                "nullable": true,
                                "example": "https://cdn.example.com/qr.png"
                            },
                            "phone_number": {
                                "type": "string",
                                "nullable": true,
                                "example": "+33600000000"
                            },
                            "expiry_date": {
                                "type": "string",
                                "nullable": true,
                                "format": "date",
                                "example": "2026-04-14"
                            },
                            "provider_status": {
                                "type": "string",
                                "nullable": true,
                                "example": "ACTIVE"
                            }
                        }
                    }
                }
            }
        }
    },
    "paths": {
        "/": {
            "get": {
                "tags": [
                    "System"
                ],
                "summary": "API root",
                "operationId": "resellerApiRoot",
                "responses": {
                    "200": {
                        "description": "API status",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "OK"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "api": {
                                                    "type": "string",
                                                    "example": "reseller"
                                                },
                                                "version": {
                                                    "type": "string",
                                                    "example": "1"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/ping": {
            "get": {
                "tags": [
                    "System"
                ],
                "summary": "Ping",
                "operationId": "resellerApiPing",
                "responses": {
                    "200": {
                        "description": "Pong",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "pong"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/login": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Create reseller API token",
                "operationId": "resellerLogin",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/LoginRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Authenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/LoginResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Invalid credentials",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorEnvelope"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Disabled or email not verified",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorEnvelope"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/logout": {
            "post": {
                "tags": [
                    "Auth"
                ],
                "summary": "Revoke current token",
                "operationId": "resellerLogout",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Logged out",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/SuccessEnvelope"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "data": {
                                                    "nullable": true
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorEnvelope"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/me": {
            "get": {
                "tags": [
                    "Auth"
                ],
                "summary": "Current reseller profile",
                "operationId": "resellerMe",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Current reseller",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/SuccessEnvelope"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "data": {
                                                    "allOf": [
                                                        {
                                                            "$ref": "#/components/schemas/ResellerUser"
                                                        },
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "status": {
                                                                    "type": "integer",
                                                                    "example": 1
                                                                },
                                                                "email_verified_at": {
                                                                    "type": "string",
                                                                    "nullable": true,
                                                                    "format": "date-time"
                                                                }
                                                            }
                                                        }
                                                    ]
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorEnvelope"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/pricing": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "summary": "Grouped pricing by country",
                "operationId": "resellerPricing",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "package_type",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "DATA",
                                "VOICE",
                                "SMS",
                                "DATA_VOICE_SMS"
                            ]
                        }
                    },
                    {
                        "name": "country_code",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "fr"
                        }
                    },
                    {
                        "name": "country_slug",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "france"
                        }
                    },
                    {
                        "name": "region_slug",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "europe"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "France"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Grouped pricing",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/SuccessEnvelope"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "data": {
                                                    "type": "object",
                                                    "properties": {
                                                        "countries": {
                                                            "type": "array",
                                                            "items": {
                                                                "$ref": "#/components/schemas/PricingCountry"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        },
        "/packages": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "summary": "List packages",
                "operationId": "resellerPackages",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "package_type",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "DATA"
                        }
                    },
                    {
                        "name": "country_code",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "fr"
                        }
                    },
                    {
                        "name": "country_slug",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "france"
                        }
                    },
                    {
                        "name": "region_slug",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "europe"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "5 GB"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Package list",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/SuccessEnvelope"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/Package"
                                                    }
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        },
        "/packages/{id}": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "summary": "Get package",
                "operationId": "resellerPackageShow",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Package details",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/SuccessEnvelope"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "data": {
                                                    "$ref": "#/components/schemas/Package"
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Package not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorEnvelope"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/orders": {
            "post": {
                "tags": [
                    "Orders"
                ],
                "summary": "Create order",
                "operationId": "resellerOrdersStore",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "$ref": "#/components/parameters/IdempotencyKey"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/OrderCreateRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Order created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/SuccessEnvelope"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "data": {
                                                    "$ref": "#/components/schemas/Order"
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthenticated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorEnvelope"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation or business error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorEnvelope"
                                }
                            }
                        }
                    }
                }
            },
            "get": {
                "tags": [
                    "Orders"
                ],
                "summary": "List orders",
                "operationId": "resellerOrdersIndex",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Order list",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/SuccessEnvelope"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/Order"
                                                    }
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        },
        "/orders/{id}": {
            "get": {
                "tags": [
                    "Orders"
                ],
                "summary": "Get order",
                "operationId": "resellerOrdersShow",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Order details",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/SuccessEnvelope"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "data": {
                                                    "$ref": "#/components/schemas/Order"
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Order not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorEnvelope"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/esims": {
            "get": {
                "tags": [
                    "eSIMs"
                ],
                "summary": "List purchased eSIMs",
                "operationId": "resellerEsimsIndex",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "eSIM list",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/SuccessEnvelope"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/Esim"
                                                    }
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        },
        "/esims/{id}": {
            "get": {
                "tags": [
                    "eSIMs"
                ],
                "summary": "Get eSIM",
                "operationId": "resellerEsimsShow",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "eSIM details",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/SuccessEnvelope"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "data": {
                                                    "$ref": "#/components/schemas/Esim"
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "eSIM not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorEnvelope"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/esims/{id}/usage": {
            "get": {
                "tags": [
                    "eSIMs"
                ],
                "summary": "Get eSIM usage",
                "operationId": "resellerEsimsUsage",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Usage details",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/SuccessEnvelope"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "data": {
                                                    "$ref": "#/components/schemas/Usage"
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Usage unavailable",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorEnvelope"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "eSIM not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorEnvelope"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/wallet": {
            "get": {
                "tags": [
                    "Wallet"
                ],
                "summary": "Get wallet balance and transactions",
                "operationId": "resellerWallet",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Wallet information",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/SuccessEnvelope"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "data": {
                                                    "$ref": "#/components/schemas/Wallet"
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "x-webhooks": {
        "security": {
            "headers": [
                {
                    "name": "X-eSIMDual-Event",
                    "description": "Webhook event name."
                },
                {
                    "name": "X-eSIMDual-Delivery",
                    "description": "Unique delivery UUID."
                },
                {
                    "name": "X-eSIMDual-Signature",
                    "description": "HMAC SHA-256 signature of the raw JSON body using the webhook secret."
                }
            ]
        },
        "events": {
            "ping": {
                "payload": {
                    "$ref": "#/components/schemas/WebhookPing"
                }
            },
            "order.completed": {
                "payload": {
                    "$ref": "#/components/schemas/WebhookOrderEvent"
                }
            },
            "order.processing": {
                "payload": {
                    "$ref": "#/components/schemas/WebhookOrderEvent"
                }
            },
            "order.failed": {
                "payload": {
                    "$ref": "#/components/schemas/WebhookOrderEvent"
                }
            }
        }
    }
}