{
  "openapi": "3.0.3",
  "info": {
    "title": "Let's Pizza Partner API",
    "version": "1.0.0",
    "description": "The one API every outside system uses to work with Let's Pizza: ERPs, POS and kitchen systems, delivery fleets, marketplaces, accounting and analytics.\n\n**Authentication.** `Authorization: Bearer <key>`. Keys are issued by Let’s Pizza per partner and environment: `lpk_test_…` works on the sandbox only, `lpk_live_…` on production only. Each key carries scopes, optionally a list of branches and of allowed addresses, a rate and an end date.\n\n**Conventions.** JSON in UTF-8. Money is integer halalas (1 riyal = 100), VAT-inclusive. Texts are `{ar, en}`. Times are ISO 8601 with an offset. Every answer carries `X-Request-Id`; authenticated answers carry `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`. Writes require an `Idempotency-Key` header: a repeat with the same key and body returns the first answer.\n\n**Errors.** Every refusal is a `PartnerError`: a stable `code`, a `message` in Arabic and English, the offending `field`, `retryable` (true only for 408/429/5xx) and the `requestId`.\n\n| Code | English | العربية |\n|---|---|---|\n| `UNAUTHENTICATED` | The API key is missing, wrong or revoked. | مفتاح الوصول مفقود أو غير صحيح أو ملغى. |\n| `KEY_EXPIRED` | The API key has expired: ask for a new one. | انتهت صلاحية مفتاح الوصول: اطلب مفتاحاً جديداً. |\n| `KEY_ENVIRONMENT_MISMATCH` | This key belongs to the other environment: test keys work on the sandbox only, live keys on production only. | هذا المفتاح لبيئة أخرى: مفاتيح الاختبار تعمل على بيئة الاختبار فقط، ومفاتيح الإنتاج على الإنتاج فقط. |\n| `PARTNER_SUSPENDED` | The partner account is suspended. Contact Let's Pizza. | حساب الشريك موقوف مؤقتاً. تواصل مع فريق ليتس بيتزا. |\n| `IP_NOT_ALLOWED` | Requests from this address are not allowed for this key. | العنوان الذي جاء منه الطلب غير مسموح لهذا المفتاح. |\n| `SCOPE_REQUIRED` | This key lacks the scope this request needs. | هذا المفتاح لا يملك الصلاحية المطلوبة لهذا الطلب. |\n| `BRANCH_NOT_ALLOWED` | This key may not act on this branch. | هذا المفتاح لا يعمل على هذا الفرع. |\n| `RATE_LIMITED` | Too many requests. Retry after the given time. | طلبات كثيرة في وقت قصير. أعد المحاولة بعد المدة المذكورة. |\n| `INVALID_REQUEST` | The request does not match the specification. | الطلب لا يطابق المواصفة. |\n| `INVALID_JSON` | The request body is not valid JSON. | جسم الطلب ليس JSON صالحاً. |\n| `PAYLOAD_TOO_LARGE` | The request body is larger than allowed. | جسم الطلب أكبر من الحد المسموح. |\n| `IDEMPOTENCY_KEY_REQUIRED` | This request needs an Idempotency-Key header (up to 128 characters). | ترويسة Idempotency-Key مطلوبة لهذا الطلب (حتى 128 حرفاً). |\n| `IDEMPOTENCY_KEY_REUSED` | The same Idempotency-Key was used with a different request. | استُخدم مفتاح Idempotency-Key نفسه مع طلب مختلف. |\n| `NOT_FOUND` | Not found. | غير موجود. |\n| `ORDER_NOT_FOUND` | The order is not one of your orders. | الطلب غير موجود ضمن طلباتك. |\n| `ACK_CONFLICT` | The order was already acknowledged with a different number. | سبق إقرار الطلب برقم مختلف. |\n| `STATUS_CHANGED` | The order moved since you read it. Read it again, then resend. | تغيّرت حالة الطلب منذ قرأتها. اقرأ الطلب ثم أعد الإرسال. |\n| `STATUS_NOT_ALLOWED` | Your settings do not allow you to report this status. | هذه الحالة غير مسموح لك بإرسالها في إعداداتك. |\n| `TRANSITION_NOT_ALLOWED` | The order cannot move to this status from where it is. | لا يمكن نقل الطلب إلى هذه الحالة من حالته الحالية. |\n| `BRANCH_NOT_LIVE` | Your integration is not switched on at this order's branch yet. | الربط غير مفعّل بعد في فرع هذا الطلب. |\n| `EVENT_ID_REUSED` | This eventId was already used for another order. | معرّف الحدث eventId مستخدم سابقاً لطلب آخر. |\n| `REASON_REQUIRED` | This status needs a reason: reasonCode or reasonText. | هذه الحالة تحتاج سبباً: reasonCode أو reasonText. |\n| `CATALOG_SOURCE_REQUIRED` | This partner is not the menu source in its settings. | هذا الشريك ليس مصدر المنيو في إعداداته. |\n| `AVAILABILITY_NOT_ENABLED` | Availability is not switched on for this partner. | إرسال التوفّر غير مفعّل لهذا الشريك. |\n| `IMPORT_NOT_FOUND` | The menu import was not found. | عملية استيراد المنيو غير موجودة. |\n| `SANDBOX_ONLY` | This tool works on the sandbox only. | هذه الأداة تعمل في بيئة الاختبار فقط. |\n| `SANDBOX_QUOTE_INVALID` | The test order could not be priced: see detail.errors (the branch may be closed). | تعذّر تسعير الطلب التجريبي: راجع detail.errors (مثلاً الفرع مغلق). |\n| `MAPPINGS_REFUSED` | The mapping request was refused whole and nothing changed: see detail.errors. | رُفض طلب الربط كاملاً ولم يتغيّر شيء: راجع detail.errors. |\n| `WEBHOOK_NOT_FOUND` | The subscription is not one of yours. | الاشتراك غير موجود ضمن اشتراكاتك. |\n| `WEBHOOK_INVALID` | The subscription is not valid: see detail.issues. | بيانات الاشتراك غير صالحة: راجع detail.issues. |\n| `FIELD_REQUIRED` | A field this event type needs is missing. | حقل مطلوب لهذا النوع من الأحداث مفقود. |\n| `CONFLICT` | Conflicts with the current state. | تعارض مع الحالة الحالية. |\n| `FORBIDDEN` | Not allowed. | غير مسموح. |\n| `INTERNAL_ERROR` | Unexpected error on our side. Retry later; if it persists, send the X-Request-Id to support. | خطأ غير متوقع لدينا. أعد المحاولة لاحقاً، وإن تكرر فأرسل رقم الطلب X-Request-Id إلى الدعم. |\n| `SERVICE_UNAVAILABLE` | The service is temporarily unavailable. Retry later. | الخدمة غير متاحة مؤقتاً. أعد المحاولة لاحقاً. |",
    "contact": {
      "name": "Let's Pizza integrations (OPT)"
    }
  },
  "servers": [
    {
      "url": "{baseUrl}",
      "description": "The base address given with your keys (sandbox or production).",
      "variables": {
        "baseUrl": {
          "default": "https://api.example.com"
        }
      }
    }
  ],
  "tags": [
    {
      "name": "Identity",
      "description": "Who the key is and what it may do."
    },
    {
      "name": "Branches",
      "description": "Let's Pizza branches as the key may see them (hours and zones stay in the Let's Pizza console)."
    },
    {
      "name": "Menu",
      "description": "The published menu with your codes, and the mapping between Let's Pizza ids and your codes."
    },
    {
      "name": "Orders",
      "description": "The order feed, acknowledgement, statuses, cancellations, facts (receipts, invoices, money collected) and payments."
    },
    {
      "name": "Availability",
      "description": "What is out at a branch now, from your POS or ERP."
    },
    {
      "name": "Reports",
      "description": "Your day as Let’s Pizza counts it, and the daily reconciliation."
    },
    {
      "name": "Sandbox",
      "description": "Tools that exist on the sandbox only: test orders."
    },
    {
      "name": "Webhooks",
      "description": "Your own signed webhook subscriptions: events pushed to your address instead of polling."
    }
  ],
  "paths": {
    "/partner/v1/me": {
      "get": {
        "operationId": "partnerMe",
        "tags": [
          "Identity"
        ],
        "summary": "The key, its partner and settings",
        "description": "Any valid key may call it: the first call to make with a new key. `environment` is the host’s (always the key’s own, or the key would be refused). `settings` say how orders, statuses, the menu and invoices flow for your system.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerMe"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/branches": {
      "get": {
        "operationId": "partnerBranches",
        "tags": [
          "Branches"
        ],
        "summary": "The branches the key may act on",
        "description": "Scope `branches:read`. `live` = your flows run at that branch; `externalCode` = your code for it once mapped.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerBranchList"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/catalog": {
      "get": {
        "operationId": "partnerCatalog",
        "tags": [
          "Menu"
        ],
        "summary": "The published menu with your codes",
        "description": "Scope `catalog:read`. The menu customers see now (categories, products — one per size —, modifier groups and options with their prices in halalas, VAT-inclusive), and under `external` your code for every id you mapped. Send `If-None-Match` with the last `ETag`: 304 when nothing changed (the menu or your mappings).",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerCatalog"
                }
              }
            }
          },
          "304": {
            "description": "Not modified"
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/mappings": {
      "get": {
        "operationId": "partnerMappings",
        "tags": [
          "Menu"
        ],
        "summary": "Your codes for our ids",
        "description": "Scope `catalog:read`. Every mapping of this key's environment: branches, categories, products (with your size as `variant`), groups, options, tenders (`online_card`, `online_apple_pay`, `online_stc_pay`, `cash_on_delivery`, `card_on_delivery`, `pay_at_branch`, `card_at_branch`).",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerMappingList"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "partnerPutMappings",
        "tags": [
          "Menu"
        ],
        "summary": "Set your codes",
        "description": "Scope `mappings:write`. All or nothing: any bad row refuses the whole request (422 with `errors[]`: UNKNOWN_ID, DUPLICATE_ROW, CODE_TAKEN). `merge` adds and replaces the rows sent; `replace` also removes the mappings of the kinds sent that are not listed. `dryRun` checks and counts only. An order whose branch, products or options are not mapped still reaches you: `external.unmapped` lists what is missing.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Your unique id of this request (≤ 128 characters). A repeat with the same key and body returns the first answer; the same key with another body is 422 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutPartnerMappingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerMappingResult"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST (`field`, `detail.issues`), IDEMPOTENCY_KEY_REQUIRED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "422": {
            "description": "MAPPINGS_REFUSED (nothing changed; `detail.errors[]` of {index, code: UNKNOWN_ID | DUPLICATE_ROW | CODE_TAKEN, field, value}; not kept as the Idempotency-Key answer, so the corrected request may reuse the key), IDEMPOTENCY_KEY_REUSED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/orders": {
      "get": {
        "operationId": "partnerOrders",
        "tags": [
          "Orders"
        ],
        "summary": "The order feed",
        "description": "Scope `orders:read`. Your orders, oldest change first. An order becomes yours when your settings say (`placed` if you accept orders, `accepted` if Let's Pizza accepts them first, `ready` for a delivery fleet), at your live branches. Poll with `state=awaiting_ack` (default) and acknowledge each; or follow everything with `state=all` and the last `nextCursor` (or `updatedSince`): any change of an order (a status, your acknowledgement) brings it back.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "awaiting_ack",
                "acked",
                "closed",
                "all"
              ],
              "default": "awaiting_ack"
            }
          },
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "updatedSince",
            "in": "query",
            "description": "ISO 8601 instant: only orders changed after it.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "The `nextCursor` of the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerOrderPage"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST (`field`: state, updatedSince, cursor, limit)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/orders/{id}": {
      "get": {
        "operationId": "partnerOrder",
        "tags": [
          "Orders"
        ],
        "summary": "One order of the feed",
        "description": "Scope `orders:read`.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The Let's Pizza order id (`order.id`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerOrder"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "404": {
            "description": "ORDER_NOT_FOUND: not one of your orders (or not at your branches)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/orders/{id}/ack": {
      "post": {
        "operationId": "partnerAckOrder",
        "tags": [
          "Orders"
        ],
        "summary": "Acknowledge an order",
        "description": "Scope `orders:ack`. The order reached your system. Send your own numbers when you have them. Acknowledge within `settings.orders.ackMinutes` or Let's Pizza is alerted (`order.ack_overdue`). A repeat with the same numbers answers the same; other numbers are 409 ACK_CONFLICT. Answers the order as it is now.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The Let's Pizza order id (`order.id`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Your unique id of this request (≤ 128 characters). A repeat with the same key and body returns the first answer; the same key with another body is 422 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AckOrderRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerOrder"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST (`field`, `detail.issues`), IDEMPOTENCY_KEY_REQUIRED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "404": {
            "description": "ORDER_NOT_FOUND: not one of your orders (or not at your branches)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "409": {
            "description": "ACK_CONFLICT (`detail.current`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/orders/{id}/status": {
      "post": {
        "operationId": "partnerOrderStatus",
        "tags": [
          "Orders"
        ],
        "summary": "Report a status",
        "description": "Scope `orders:status`; `to` must be in your `settings.orders.statuses`. The order moves forward only, through the steps between (a `ready` before `preparing` passes both); one behind it is `ignored`; a finished order never moves. `rejected` applies from `placed`, `cancelled` from `placed` or `accepted`: later they are `parked` for a person. `delivery_failed` needs a `reasonCode` (or `reasonText`). Each `eventId` is applied once (`duplicate`).",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The Let's Pizza order id (`order.id`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Your unique id of this request (≤ 128 characters). A repeat with the same key and body returns the first answer; the same key with another body is 422 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PartnerStatusRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerStatusResult"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST (`field`, `detail.issues`), IDEMPOTENCY_KEY_REQUIRED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "STATUS_NOT_ALLOWED (`detail.allowed`), PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED, BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "404": {
            "description": "ORDER_NOT_FOUND: not one of your orders (or not at your branches)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "409": {
            "description": "STATUS_CHANGED (`expectedFrom` no longer true; `detail.current`), BRANCH_NOT_LIVE, EVENT_ID_REUSED (the eventId belongs to another order)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "422": {
            "description": "REASON_REQUIRED, IDEMPOTENCY_KEY_REUSED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/orders/{id}/cancel": {
      "post": {
        "operationId": "partnerCancelOrder",
        "tags": [
          "Orders"
        ],
        "summary": "Cancel an order",
        "description": "Scope `orders:cancel`. Applies before the kitchen starts (`placed`, `accepted`); later it is `parked` and Let’s Pizza staff decide (the food may be made and paid). Same answer and rules as a status.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The Let's Pizza order id (`order.id`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Your unique id of this request (≤ 128 characters). A repeat with the same key and body returns the first answer; the same key with another body is 422 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PartnerCancelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerStatusResult"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST (`field`, `detail.issues`), IDEMPOTENCY_KEY_REQUIRED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "404": {
            "description": "ORDER_NOT_FOUND: not one of your orders (or not at your branches)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "409": {
            "description": "BRANCH_NOT_LIVE, EVENT_ID_REUSED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/orders/{id}/events": {
      "post": {
        "operationId": "partnerOrderEvent",
        "tags": [
          "Orders"
        ],
        "summary": "Record a fact on an order",
        "description": "Scope `orders:events`. `receipt_issued` (`receiptNo`), `invoice_issued` (`invoiceNo`, optional ZATCA `invoiceQr`), `payment_collected` (`amount` in halalas, `tender`), `note` (`note`). Each `eventId` once.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The Let's Pizza order id (`order.id`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Your unique id of this request (≤ 128 characters). A repeat with the same key and body returns the first answer; the same key with another body is 422 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PartnerOrderEventRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerOrderEventResult"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST (`field`, `detail.issues`), IDEMPOTENCY_KEY_REQUIRED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "404": {
            "description": "ORDER_NOT_FOUND: not one of your orders (or not at your branches)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "409": {
            "description": "EVENT_ID_REUSED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "422": {
            "description": "FIELD_REQUIRED (`field`), IDEMPOTENCY_KEY_REUSED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/orders/{id}/payments": {
      "get": {
        "operationId": "partnerOrderPayments",
        "tags": [
          "Orders"
        ],
        "summary": "How an order is paid",
        "description": "Scope `payments:read`. The method, what was paid and refunded (halalas), the online payment attempts and the refunds.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The Let's Pizza order id (`order.id`).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerOrderPayments"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "404": {
            "description": "ORDER_NOT_FOUND: not one of your orders (or not at your branches)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/webhooks": {
      "get": {
        "operationId": "partnerWebhooks",
        "tags": [
          "Webhooks"
        ],
        "summary": "Your subscriptions",
        "description": "Scope `webhooks:manage`. Your own subscriptions on the Let’s Pizza webhook service: signed deliveries (`X-LP-Signature: v1=<hex HMAC-SHA256(secret, \"<X-LP-Timestamp>.<raw body>\")>`), retries after 1 min, 5 min, 30 min, 2 h and 12 h, a delivery log and replay. The branches are your key’s; whether the customer’s full details travel is your `settings.customerData`, not the request.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookSubscription"
                  }
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "partnerCreateWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Subscribe an address",
        "description": "Scope `webhooks:manage`. Your own subscriptions on the Let’s Pizza webhook service: signed deliveries (`X-LP-Signature: v1=<hex HMAC-SHA256(secret, \"<X-LP-Timestamp>.<raw body>\")>`), retries after 1 min, 5 min, 30 min, 2 h and 12 h, a delivery log and replay. The branches are your key’s; whether the customer’s full details travel is your `settings.customerData`, not the request. The signing secret is returned this once (a replay of the same request answers the subscription with an empty secret: rotate it if it was lost).",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Your unique id of this request (≤ 128 characters). A repeat with the same key and body returns the first answer; the same key with another body is 422 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSecretIssued"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST (`field`, `detail.issues`), IDEMPOTENCY_KEY_REQUIRED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "422": {
            "description": "WEBHOOK_INVALID (`detail.issues[]` of {path, code}: URL_INVALID, URL_NOT_HTTPS, URL_PRIVATE_ADDRESS, URL_CREDENTIALS, EVENT_NOT_AVAILABLE, EVENT_REPEATED, BRANCHES_EMPTY, BRANCH_UNKNOWN), IDEMPOTENCY_KEY_REUSED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/webhooks/{id}": {
      "get": {
        "operationId": "partnerWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "One subscription",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSubscription"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "404": {
            "description": "WEBHOOK_NOT_FOUND: not one of your subscriptions",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "partnerUpdateWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Change a subscription",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWebhookRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSubscription"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "404": {
            "description": "WEBHOOK_NOT_FOUND: not one of your subscriptions",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "422": {
            "description": "WEBHOOK_INVALID (`detail.issues[]` of {path, code}: URL_INVALID, URL_NOT_HTTPS, URL_PRIVATE_ADDRESS, URL_CREDENTIALS, EVENT_NOT_AVAILABLE, EVENT_REPEATED, BRANCHES_EMPTY, BRANCH_UNKNOWN), IDEMPOTENCY_KEY_REUSED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "partnerDeleteWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Remove a subscription and its log",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removed"
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "404": {
            "description": "WEBHOOK_NOT_FOUND: not one of your subscriptions",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/webhooks/{id}/secret": {
      "post": {
        "operationId": "partnerRotateWebhookSecret",
        "tags": [
          "Webhooks"
        ],
        "summary": "A new signing secret",
        "description": "Returned this once; the old secret stops working at once.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSecretIssued"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "404": {
            "description": "WEBHOOK_NOT_FOUND: not one of your subscriptions",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/webhooks/{id}/test": {
      "post": {
        "operationId": "partnerTestWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a signed ping now",
        "description": "One attempt, logged like any delivery, never retried.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Sent",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "404": {
            "description": "WEBHOOK_NOT_FOUND: not one of your subscriptions",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/webhooks/{id}/deliveries": {
      "get": {
        "operationId": "partnerWebhookDeliveries",
        "tags": [
          "Webhooks"
        ],
        "summary": "The delivery log",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Comma-separated: pending, delivered, failed, dead.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliveryPage"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "404": {
            "description": "WEBHOOK_NOT_FOUND: not one of your subscriptions",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/webhooks/{id}/deliveries/{deliveryId}/replay": {
      "post": {
        "operationId": "partnerReplayWebhookDelivery",
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a delivery again",
        "description": "A new delivery of the same envelope (same `id`: deduplicate on it), sent by the worker.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Queued",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "404": {
            "description": "WEBHOOK_NOT_FOUND: not one of your subscriptions",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/catalog/imports": {
      "post": {
        "operationId": "partnerImportMenu",
        "tags": [
          "Menu"
        ],
        "summary": "Send your menu",
        "description": "Scope `catalog:write`, and your settings must name you the menu source. Your codes are matched to Let's Pizza ids through your mappings; only the fields your settings give you change (names, descriptions, prices, groups, options, categories, availability). Pictures, the pizza builder, display order and sections stay with Let's Pizza. A code with no mapping is listed in `unknown`, never added on its own. `blocked`, and in a `full` menu a mapped product you no longer list, take the item off at your live branches (never a deletion). The candidate is checked like any menu edit (`issues`) and compared with what customers see (`diff`). Then your publish policy decides: `manual` waits for Let's Pizza staff (`staged`); `auto_prices` publishes price-only changes within `maxPriceChangePct`; `auto` publishes unless more than `maxRemovals` products would go. `dryRun` returns the report without keeping it. A newer menu replaces a staged one (`superseded`).",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Your unique id of this request (≤ 128 characters). A repeat with the same key and body returns the first answer; the same key with another body is 422 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PartnerMenu"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Received (status says what became of it)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogImport"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST (`field`, `detail.issues`), IDEMPOTENCY_KEY_REQUIRED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "CATALOG_SOURCE_REQUIRED, SCOPE_REQUIRED, PARTNER_SUSPENDED, IP_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "422": {
            "description": "IDEMPOTENCY_KEY_REUSED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "partnerMenuImports",
        "tags": [
          "Menu"
        ],
        "summary": "Your last menus",
        "description": "Scope `catalog:write`. Newest first, with what became of each.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogImportList"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/catalog/imports/{id}": {
      "get": {
        "operationId": "partnerMenuImport",
        "tags": [
          "Menu"
        ],
        "summary": "One menu import",
        "description": "Scope `catalog:write`.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogImport"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "404": {
            "description": "IMPORT_NOT_FOUND",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/branches/{id}/availability": {
      "put": {
        "operationId": "partnerSetAvailability",
        "tags": [
          "Availability"
        ],
        "summary": "Your unavailable items at a branch (whole list)",
        "description": "Scope `availability:write`. Everything your system says is out at this branch now, by our id or your code: your earlier flags not listed are cleared. A flag branch staff set is never cleared by you (`keptStaff`). Changes reach the website and the app at once.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The Let's Pizza branch id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Your unique id of this request (≤ 128 characters). A repeat with the same key and body returns the first answer; the same key with another body is 422 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PartnerAvailabilityRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerAvailabilityResult"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST (`field`, `detail.issues`), IDEMPOTENCY_KEY_REQUIRED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "AVAILABILITY_NOT_ENABLED, BRANCH_NOT_ALLOWED, SCOPE_REQUIRED, PARTNER_SUSPENDED, IP_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "409": {
            "description": "BRANCH_NOT_LIVE: your integration is not switched on at this branch yet",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "partnerChangeAvailability",
        "tags": [
          "Availability"
        ],
        "summary": "Change availability at a branch",
        "description": "Scope `availability:write`. Only the items listed: `available: false` takes one off, `true` puts back one you took off.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The Let's Pizza branch id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Your unique id of this request (≤ 128 characters). A repeat with the same key and body returns the first answer; the same key with another body is 422 IDEMPOTENCY_KEY_REUSED.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PartnerAvailabilityRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerAvailabilityResult"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST (`field`, `detail.issues`), IDEMPOTENCY_KEY_REQUIRED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "AVAILABILITY_NOT_ENABLED, BRANCH_NOT_ALLOWED, SCOPE_REQUIRED, PARTNER_SUSPENDED, IP_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "409": {
            "description": "BRANCH_NOT_LIVE: your integration is not switched on at this branch yet",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/reports/daily": {
      "get": {
        "operationId": "partnerDailyReport",
        "tags": [
          "Reports"
        ],
        "summary": "Your day per branch",
        "description": "Scope `reports:read`. Your orders created on a Riyadh calendar day (00:00–24:00 +03:00) at the branches your key may see: per branch how many, served (delivered or picked up), ended unserved, still open, the served total and refunds (halalas, VAT-inclusive); and the served orders with your order numbers. Use it every morning for the day before.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerDailyReport"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST (`field`: date)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/reports/reconciliation": {
      "post": {
        "operationId": "partnerReconciliation",
        "tags": [
          "Reports"
        ],
        "summary": "Compare your count of a day with ours",
        "description": "Scope `reports:read`. Send your served count and total per branch (and, best, your order numbers): the answer says per branch whether they match, which of your numbers we do not know, and which of our served orders you did not list. Nothing is stored.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PartnerReconciliationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerReconciliation"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/oauth/token": {
      "post": {
        "operationId": "partnerOAuthToken",
        "tags": [
          "Identity"
        ],
        "summary": "OAuth 2.0 access token (client credentials)",
        "description": "For systems that prefer OAuth to a fixed key. `grant_type=client_credentials`, `client_id` = your key’s id (the `key.id` of `GET /me`), `client_secret` = the key; in a JSON or form body, or in HTTP Basic. The answer is a bearer token `lpt_…` valid for one hour (never past the key’s own end) with the key’s scopes: send it as `Authorization: Bearer` exactly like the key. A revoked key stops its tokens at once. Refusals carry `detail.error` (`invalid_client`, `unsupported_grant_type`, `invalid_request`).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PartnerTokenRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PartnerTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerTokenResponse"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST (`detail.error`: invalid_request, unsupported_grant_type)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (`detail.error`: invalid_client), KEY_ENVIRONMENT_MISMATCH",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/logs": {
      "get": {
        "operationId": "partnerLogs",
        "tags": [
          "Identity"
        ],
        "summary": "Your request log",
        "description": "Every request of your keys in this environment (refusals included), newest first, kept 30 days; never a body. `nextBefore` pages back. Quote a `requestId` to support.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "parameters": [
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerRequestLogPage"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "PARTNER_SUSPENDED, IP_NOT_ALLOWED, SCOPE_REQUIRED (`detail.required` lists the scopes), BRANCH_NOT_ALLOWED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    },
    "/partner/v1/sandbox/orders": {
      "post": {
        "operationId": "partnerSandboxOrder",
        "tags": [
          "Sandbox"
        ],
        "summary": "Place a test order",
        "description": "Sandbox only (403 SANDBOX_ONLY on production). Scopes `orders:read` and `orders:status`. A real order on the sandbox, made the way a customer’s is (quote, then order), so it reaches your feed, your webhooks and your connector like any order — at a branch your key may act on. Lines absent = one Margherita. Then move it with your status calls, or let the sandbox branch staff do it.",
        "security": [
          {
            "partnerKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PartnerSandboxOrderRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Limit": {
                "description": "The key's requests per minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Requests left in the current minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the minute window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED (no key, a wrong or revoked one), KEY_EXPIRED, KEY_ENVIRONMENT_MISMATCH (a test key on production or the other way round)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "403": {
            "description": "SANDBOX_ONLY, BRANCH_NOT_ALLOWED, SCOPE_REQUIRED",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "422": {
            "description": "SANDBOX_QUOTE_INVALID (`detail.errors`: the quote’s codes, e.g. BRANCH_CLOSED)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: wait `Retry-After` seconds (also in `detail.retryAfterSeconds`)",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: retryable; quote the X-Request-Id if it persists",
            "headers": {
              "X-Request-Id": {
                "description": "The id of this request: quote it to support. Send your own (8–64 of `A-Z a-z 0-9 . _ -`) to trace a call end to end.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PartnerKind": {
        "type": "string",
        "enum": [
          "erp",
          "pos",
          "kds",
          "delivery",
          "marketplace",
          "accounting",
          "analytics",
          "other"
        ]
      },
      "PartnerScope": {
        "type": "string",
        "enum": [
          "branches:read",
          "catalog:read",
          "catalog:write",
          "availability:write",
          "orders:read",
          "orders:ack",
          "orders:status",
          "orders:cancel",
          "orders:events",
          "payments:read",
          "reports:read",
          "webhooks:manage",
          "mappings:write"
        ]
      },
      "PartnerSettings": {
        "type": "object",
        "properties": {
          "orders": {
            "type": "object",
            "properties": {
              "delivery": {
                "$ref": "#/components/schemas/OrderDelivery"
              },
              "acceptance": {
                "$ref": "#/components/schemas/OrderAcceptance"
              },
              "ackMinutes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 120
              },
              "statuses": {
                "maxItems": 9,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PartnerStatusTarget"
                }
              },
              "connector": {
                "nullable": true,
                "type": "string",
                "maxLength": 40
              }
            },
            "required": [
              "delivery",
              "acceptance",
              "ackMinutes",
              "statuses",
              "connector"
            ]
          },
          "catalog": {
            "type": "object",
            "properties": {
              "source": {
                "type": "boolean"
              },
              "fields": {
                "maxItems": 8,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CatalogField"
                }
              },
              "publish": {
                "$ref": "#/components/schemas/CatalogPublishPolicy"
              },
              "maxPriceChangePct": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "maxRemovals": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000
              }
            },
            "required": [
              "source",
              "fields",
              "publish",
              "maxPriceChangePct",
              "maxRemovals"
            ]
          },
          "availability": {
            "type": "boolean"
          },
          "invoices": {
            "type": "object",
            "properties": {
              "issuer": {
                "$ref": "#/components/schemas/InvoiceIssuer"
              }
            },
            "required": [
              "issuer"
            ]
          },
          "customerData": {
            "type": "string",
            "enum": [
              "full",
              "masked"
            ]
          },
          "liveBranches": {
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        },
        "required": [
          "orders",
          "catalog",
          "availability",
          "invoices",
          "customerData",
          "liveBranches"
        ]
      },
      "OrderDelivery": {
        "type": "string",
        "enum": [
          "none",
          "pull",
          "webhooks",
          "connector"
        ]
      },
      "OrderAcceptance": {
        "type": "string",
        "enum": [
          "lp",
          "partner"
        ]
      },
      "PartnerStatusTarget": {
        "type": "string",
        "enum": [
          "accepted",
          "rejected",
          "preparing",
          "ready",
          "picked_up",
          "cancelled",
          "out_for_delivery",
          "delivered",
          "delivery_failed"
        ]
      },
      "CatalogField": {
        "type": "string",
        "enum": [
          "names",
          "descriptions",
          "prices",
          "sizes",
          "groups",
          "options",
          "categories",
          "availability"
        ]
      },
      "CatalogPublishPolicy": {
        "type": "string",
        "enum": [
          "manual",
          "auto_prices",
          "auto"
        ]
      },
      "InvoiceIssuer": {
        "type": "string",
        "enum": [
          "lp",
          "partner"
        ]
      },
      "PartnerMe": {
        "type": "object",
        "properties": {
          "partner": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "name": {
                "type": "string"
              },
              "kind": {
                "$ref": "#/components/schemas/PartnerKind"
              }
            },
            "required": [
              "id",
              "name",
              "kind"
            ]
          },
          "key": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "env": {
                "$ref": "#/components/schemas/IntegrationMode"
              },
              "label": {
                "type": "string"
              },
              "prefix": {
                "type": "string"
              },
              "scopes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PartnerScope"
                }
              },
              "branches": {
                "nullable": true,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                }
              },
              "ratePerMinute": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "expiresAt": {
                "nullable": true,
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              }
            },
            "required": [
              "id",
              "env",
              "label",
              "prefix",
              "scopes",
              "branches",
              "ratePerMinute",
              "expiresAt"
            ]
          },
          "environment": {
            "$ref": "#/components/schemas/IntegrationMode"
          },
          "settings": {
            "$ref": "#/components/schemas/PartnerSettings"
          },
          "apiVersion": {
            "type": "string",
            "enum": [
              "v1"
            ]
          },
          "serverTime": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "partner",
          "key",
          "environment",
          "settings",
          "apiVersion",
          "serverTime"
        ]
      },
      "IntegrationMode": {
        "type": "string",
        "enum": [
          "sandbox",
          "live"
        ]
      },
      "PartnerBranch": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "names": {
            "$ref": "#/components/schemas/Localized"
          },
          "phone": {
            "type": "string"
          },
          "location": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number"
              },
              "lng": {
                "type": "number"
              }
            },
            "required": [
              "lat",
              "lng"
            ]
          },
          "fulfilment": {
            "type": "object",
            "properties": {
              "delivery": {
                "type": "boolean"
              },
              "pickup": {
                "type": "boolean"
              }
            },
            "required": [
              "delivery",
              "pickup"
            ]
          },
          "paused": {
            "type": "boolean"
          },
          "live": {
            "type": "boolean"
          },
          "externalCode": {
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "id",
          "names",
          "phone",
          "location",
          "fulfilment",
          "paused",
          "live",
          "externalCode"
        ]
      },
      "Localized": {
        "type": "object",
        "properties": {
          "ar": {
            "type": "string"
          },
          "en": {
            "type": "string"
          }
        },
        "required": [
          "ar",
          "en"
        ]
      },
      "PartnerBranchList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartnerBranch"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "PartnerError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "$ref": "#/components/schemas/Localized"
          },
          "field": {
            "nullable": true,
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          },
          "requestId": {
            "type": "string"
          },
          "detail": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "required": [
          "code",
          "message",
          "field",
          "retryable",
          "requestId"
        ]
      },
      "PartnerMappingKind": {
        "type": "string",
        "enum": [
          "branch",
          "category",
          "product",
          "group",
          "option",
          "tender"
        ]
      },
      "PartnerMapping": {
        "type": "object",
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/PartnerMappingKind"
          },
          "ourId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "variant": {
            "nullable": true,
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "unit": {
            "nullable": true,
            "type": "string",
            "minLength": 1,
            "maxLength": 20
          },
          "ourName": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/Localized"
              }
            ]
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "kind",
          "ourId",
          "code",
          "variant",
          "unit",
          "ourName",
          "updatedAt"
        ]
      },
      "PartnerMappingList": {
        "type": "object",
        "properties": {
          "env": {
            "$ref": "#/components/schemas/IntegrationMode"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartnerMapping"
            }
          }
        },
        "required": [
          "env",
          "items"
        ]
      },
      "PutPartnerMappingsRequest": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "merge",
              "replace"
            ]
          },
          "dryRun": {
            "type": "boolean"
          },
          "items": {
            "maxItems": 5000,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "$ref": "#/components/schemas/PartnerMappingKind"
                },
                "ourId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "code": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 50
                },
                "variant": {
                  "nullable": true,
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 50
                },
                "unit": {
                  "nullable": true,
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 20
                }
              },
              "required": [
                "kind",
                "ourId",
                "code"
              ]
            }
          }
        },
        "required": [
          "mode",
          "items"
        ]
      },
      "PartnerMappingIssue": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "code": {
            "type": "string",
            "enum": [
              "UNKNOWN_ID",
              "DUPLICATE_ROW",
              "CODE_TAKEN"
            ]
          },
          "field": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "required": [
          "index",
          "code",
          "field",
          "value"
        ]
      },
      "PartnerMappingResult": {
        "type": "object",
        "properties": {
          "dryRun": {
            "type": "boolean"
          },
          "ok": {
            "type": "boolean"
          },
          "added": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "updated": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "unchanged": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "removed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartnerMappingIssue"
            }
          }
        },
        "required": [
          "dryRun",
          "ok",
          "added",
          "updated",
          "unchanged",
          "removed",
          "errors"
        ]
      },
      "PartnerOrderState": {
        "type": "string",
        "enum": [
          "awaiting_ack",
          "acked",
          "closed"
        ]
      },
      "PartnerOrderExternal": {
        "type": "object",
        "properties": {
          "branchCode": {
            "nullable": true,
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "lineIndex": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "code": {
                  "nullable": true,
                  "type": "string"
                },
                "variant": {
                  "nullable": true,
                  "type": "string"
                },
                "unit": {
                  "nullable": true,
                  "type": "string"
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "groupId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "optionId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "code": {
                        "nullable": true,
                        "type": "string"
                      },
                      "variant": {
                        "nullable": true,
                        "type": "string"
                      }
                    },
                    "required": [
                      "groupId",
                      "optionId",
                      "code",
                      "variant"
                    ]
                  }
                }
              },
              "required": [
                "lineIndex",
                "code",
                "variant",
                "unit",
                "options"
              ]
            }
          },
          "tenderCode": {
            "nullable": true,
            "type": "string"
          },
          "unmapped": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "$ref": "#/components/schemas/PartnerMappingKind"
                },
                "ourId": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "ourId"
              ]
            }
          }
        },
        "required": [
          "branchCode",
          "lines",
          "tenderCode",
          "unmapped"
        ]
      },
      "PartnerOrder": {
        "type": "object",
        "properties": {
          "order": {
            "$ref": "#/components/schemas/Order"
          },
          "state": {
            "$ref": "#/components/schemas/PartnerOrderState"
          },
          "ackDueAt": {
            "nullable": true,
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "ackedAt": {
            "nullable": true,
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "externalOrderNo": {
            "nullable": true,
            "type": "string"
          },
          "externalReceiptNo": {
            "nullable": true,
            "type": "string"
          },
          "external": {
            "$ref": "#/components/schemas/PartnerOrderExternal"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "order",
          "state",
          "ackDueAt",
          "ackedAt",
          "externalOrderNo",
          "externalReceiptNo",
          "external",
          "updatedAt"
        ]
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "number": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending_payment",
              "payment_failed",
              "placed",
              "accepted",
              "preparing",
              "ready",
              "out_for_delivery",
              "delivered",
              "picked_up",
              "cancelled",
              "rejected",
              "delivery_failed",
              "not_collected"
            ]
          },
          "channel": {
            "type": "string",
            "enum": [
              "app",
              "web",
              "console",
              "pos",
              "dine_in"
            ]
          },
          "branchId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "fulfilment": {
            "type": "string",
            "enum": [
              "delivery",
              "pickup"
            ]
          },
          "paymentMethod": {
            "type": "string",
            "enum": [
              "pay_at_branch",
              "cash_on_delivery",
              "online"
            ]
          },
          "catalogVersion": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderLine"
            }
          },
          "subtotal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          },
          "discounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Discount"
            }
          },
          "discountTotal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          },
          "deliveryFee": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          },
          "vat": {
            "type": "object",
            "properties": {
              "rateBps": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "amount": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
              },
              "includesDeliveryFee": {
                "type": "boolean"
              }
            },
            "required": [
              "rateBps",
              "amount",
              "includesDeliveryFee"
            ]
          },
          "scheduledFor": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "note": {
            "type": "string"
          },
          "cutlery": {
            "type": "boolean"
          },
          "ifUnavailable": {
            "allOf": [
              {
                "$ref": "#/components/schemas/IfUnavailable"
              }
            ]
          },
          "delivery": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DeliveryDetails"
              }
            ]
          },
          "courier": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Courier"
              }
            ]
          },
          "tender": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Tender"
              }
            ]
          },
          "paidAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatusChange"
            }
          }
        },
        "required": [
          "id",
          "number",
          "status",
          "channel",
          "branchId",
          "fulfilment",
          "paymentMethod",
          "catalogVersion",
          "lines",
          "subtotal",
          "discounts",
          "discountTotal",
          "deliveryFee",
          "total",
          "vat",
          "createdAt",
          "history"
        ]
      },
      "OrderLine": {
        "type": "object",
        "properties": {
          "lineIndex": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "line": {
            "$ref": "#/components/schemas/CartLine"
          },
          "unitPrice": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          },
          "lineTotal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          },
          "snapshot": {
            "$ref": "#/components/schemas/LineSnapshot"
          }
        },
        "required": [
          "lineIndex",
          "line",
          "unitPrice",
          "lineTotal",
          "snapshot"
        ]
      },
      "CartLine": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "qty": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "selections": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CartSelection"
            }
          },
          "note": {
            "type": "string",
            "maxLength": 200
          },
          "source": {
            "type": "object",
            "properties": {
              "experience": {
                "type": "string",
                "enum": [
                  "classic",
                  "graphical"
                ]
              },
              "mode": {
                "type": "string",
                "maxLength": 32
              }
            },
            "required": [
              "experience"
            ]
          }
        },
        "required": [
          "productId",
          "qty",
          "selections"
        ]
      },
      "CartSelection": {
        "type": "object",
        "properties": {
          "groupId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "optionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "qty": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "placement": {
            "type": "string",
            "enum": [
              "whole",
              "left",
              "right"
            ]
          },
          "amount": {
            "type": "string",
            "enum": [
              "light",
              "regular",
              "extra"
            ]
          }
        },
        "required": [
          "groupId",
          "optionId",
          "qty"
        ]
      },
      "LineSnapshot": {
        "type": "object",
        "properties": {
          "names": {
            "$ref": "#/components/schemas/Localized"
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SnapshotOption"
            }
          }
        },
        "required": [
          "names",
          "options"
        ]
      },
      "SnapshotOption": {
        "type": "object",
        "properties": {
          "groupId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "optionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "names": {
            "$ref": "#/components/schemas/Localized"
          },
          "qty": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "price": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          },
          "placement": {
            "type": "string",
            "enum": [
              "whole",
              "left",
              "right"
            ]
          },
          "amount": {
            "type": "string",
            "enum": [
              "light",
              "regular",
              "extra"
            ]
          }
        },
        "required": [
          "groupId",
          "optionId",
          "names",
          "qty",
          "price"
        ]
      },
      "Discount": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "coupon",
              "offer"
            ]
          },
          "code": {
            "type": "string"
          },
          "names": {
            "$ref": "#/components/schemas/Localized"
          },
          "amount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          }
        },
        "required": [
          "kind",
          "names",
          "amount"
        ]
      },
      "IfUnavailable": {
        "type": "string",
        "enum": [
          "call",
          "replace",
          "remove",
          "cancel"
        ]
      },
      "DeliveryDetails": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "minLength": 3,
            "maxLength": 300
          },
          "details": {
            "type": "string",
            "maxLength": 300
          },
          "location": {
            "allOf": [
              {
                "$ref": "#/components/schemas/GeoPoint"
              }
            ]
          },
          "contactName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "contactPhone": {
            "type": "string",
            "minLength": 9,
            "maxLength": 20
          }
        },
        "required": [
          "address",
          "contactName",
          "contactPhone"
        ]
      },
      "GeoPoint": {
        "type": "object",
        "properties": {
          "lat": {
            "type": "number",
            "minimum": -90,
            "maximum": 90
          },
          "lng": {
            "type": "number",
            "minimum": -180,
            "maximum": 180
          }
        },
        "required": [
          "lat",
          "lng"
        ]
      },
      "Courier": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "Tender": {
        "type": "string",
        "enum": [
          "cash",
          "card"
        ]
      },
      "StatusChange": {
        "type": "object",
        "properties": {
          "from": {
            "nullable": true,
            "type": "string",
            "enum": [
              "pending_payment",
              "payment_failed",
              "placed",
              "accepted",
              "preparing",
              "ready",
              "out_for_delivery",
              "delivered",
              "picked_up",
              "cancelled",
              "rejected",
              "delivery_failed",
              "not_collected"
            ]
          },
          "to": {
            "type": "string",
            "enum": [
              "pending_payment",
              "payment_failed",
              "placed",
              "accepted",
              "preparing",
              "ready",
              "out_for_delivery",
              "delivered",
              "picked_up",
              "cancelled",
              "rejected",
              "delivery_failed",
              "not_collected"
            ]
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "actor": {
            "$ref": "#/components/schemas/StatusChangeActor"
          },
          "reason": {
            "type": "string"
          },
          "reasonCode": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExitReasonCode"
              }
            ]
          },
          "returnedToBranch": {
            "type": "boolean"
          }
        },
        "required": [
          "from",
          "to",
          "at",
          "actor"
        ]
      },
      "StatusChangeActor": {
        "type": "string",
        "enum": [
          "customer",
          "staff",
          "system",
          "payment",
          "partner"
        ]
      },
      "ExitReasonCode": {
        "type": "string",
        "enum": [
          "customer_unreachable",
          "wrong_address",
          "customer_refused",
          "accident_or_damage",
          "kitchen_error",
          "out_of_stock",
          "customer_request",
          "other"
        ]
      },
      "PartnerOrderPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartnerOrder"
            }
          },
          "nextCursor": {
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "items",
          "nextCursor"
        ]
      },
      "AckOrderRequest": {
        "type": "object",
        "properties": {
          "externalOrderNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "externalReceiptNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          }
        }
      },
      "PartnerStatusRequest": {
        "type": "object",
        "properties": {
          "eventId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "to": {
            "$ref": "#/components/schemas/PartnerStatusTarget"
          },
          "expectedFrom": {
            "type": "string",
            "enum": [
              "pending_payment",
              "payment_failed",
              "placed",
              "accepted",
              "preparing",
              "ready",
              "out_for_delivery",
              "delivered",
              "picked_up",
              "cancelled",
              "rejected",
              "delivery_failed",
              "not_collected"
            ]
          },
          "reasonCode": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExitReasonCode"
              }
            ]
          },
          "reasonText": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "estimatedReadyAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "eventId",
          "to",
          "occurredAt"
        ]
      },
      "PartnerCancelRequest": {
        "type": "object",
        "properties": {
          "eventId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "reasonCode": {
            "$ref": "#/components/schemas/ExitReasonCode"
          },
          "reasonText": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "eventId",
          "reasonCode",
          "occurredAt"
        ]
      },
      "PartnerStatusResult": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "applied",
              "duplicate",
              "ignored",
              "parked"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending_payment",
              "payment_failed",
              "placed",
              "accepted",
              "preparing",
              "ready",
              "out_for_delivery",
              "delivered",
              "picked_up",
              "cancelled",
              "rejected",
              "delivery_failed",
              "not_collected"
            ]
          },
          "reason": {
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "outcome",
          "status",
          "reason"
        ]
      },
      "PartnerOrderEventRequest": {
        "type": "object",
        "properties": {
          "eventId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "type": {
            "type": "string",
            "enum": [
              "receipt_issued",
              "invoice_issued",
              "payment_collected",
              "note"
            ]
          },
          "receiptNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "invoiceNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "invoiceQr": {
            "type": "string",
            "maxLength": 1000
          },
          "amount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          },
          "tender": {
            "type": "string",
            "enum": [
              "cash",
              "card"
            ]
          },
          "note": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "eventId",
          "type",
          "occurredAt"
        ]
      },
      "PartnerOrderEventResult": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "recorded",
              "duplicate"
            ]
          }
        },
        "required": [
          "outcome"
        ]
      },
      "PartnerCatalog": {
        "type": "object",
        "properties": {
          "catalog": {
            "$ref": "#/components/schemas/Catalog"
          },
          "external": {
            "type": "object",
            "properties": {
              "categories": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "products": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "variant": {
                      "nullable": true,
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "variant"
                  ]
                }
              },
              "groups": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "options": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "variant": {
                      "nullable": true,
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "variant"
                  ]
                }
              }
            },
            "required": [
              "categories",
              "products",
              "groups",
              "options"
            ]
          }
        },
        "required": [
          "catalog",
          "external"
        ]
      },
      "Catalog": {
        "type": "object",
        "properties": {
          "version": {
            "$ref": "#/components/schemas/CatalogVersion"
          },
          "currency": {
            "type": "string",
            "enum": [
              "SAR"
            ]
          },
          "categories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Category"
            }
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModifierGroup"
            }
          },
          "products": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Product"
            }
          },
          "builderArt": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BuilderArt"
              }
            ]
          }
        },
        "required": [
          "version",
          "currency",
          "categories",
          "groups",
          "products"
        ]
      },
      "CatalogVersion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "published"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "taker",
              "console",
              "foodics",
              "partner"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "id",
          "status",
          "source",
          "createdAt"
        ]
      },
      "Category": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "names": {
            "$ref": "#/components/schemas/Localized"
          },
          "image": {
            "type": "string"
          },
          "sort": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "external": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExternalRef"
              }
            ]
          }
        },
        "required": [
          "id",
          "names",
          "sort"
        ]
      },
      "ExternalRef": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "taker",
              "foodics",
              "console"
            ]
          },
          "id": {
            "type": "string"
          }
        },
        "required": [
          "source",
          "id"
        ]
      },
      "ModifierGroup": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "names": {
            "$ref": "#/components/schemas/Localized"
          },
          "role": {
            "type": "string",
            "enum": [
              "choice",
              "extra",
              "removal",
              "cross_sell",
              "bundle_slot"
            ]
          },
          "selection": {
            "type": "string",
            "enum": [
              "single",
              "multi"
            ]
          },
          "builder": {
            "allOf": [
              {
                "$ref": "#/components/schemas/GroupBuilderHints"
              }
            ]
          },
          "minSelect": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "maxSelect": {
            "nullable": true,
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "perOptionMaxQty": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GroupOption"
            }
          },
          "defaultOptionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "descriptions": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Localized"
              }
            ]
          },
          "external": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExternalRef"
              }
            ]
          }
        },
        "required": [
          "id",
          "names",
          "role",
          "selection",
          "minSelect",
          "maxSelect",
          "perOptionMaxQty",
          "options"
        ]
      },
      "GroupBuilderHints": {
        "type": "object",
        "properties": {
          "part": {
            "type": "string",
            "enum": [
              "dough",
              "edge",
              "sauce",
              "cheese",
              "topping",
              "fresh",
              "finish"
            ]
          },
          "placement": {
            "type": "boolean"
          },
          "amount": {
            "type": "boolean"
          }
        },
        "required": [
          "part",
          "placement",
          "amount"
        ]
      },
      "GroupOption": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "names": {
            "$ref": "#/components/schemas/Localized"
          },
          "price": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          },
          "priceBySize": {
            "type": "object",
            "properties": {
              "medium": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
              },
              "large": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
              }
            }
          },
          "builder": {
            "allOf": [
              {
                "$ref": "#/components/schemas/OptionBuilderHints"
              }
            ]
          },
          "image": {
            "type": "string"
          },
          "linkedProductId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "hidden": {
            "type": "boolean"
          },
          "external": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExternalRef"
              }
            ]
          }
        },
        "required": [
          "id",
          "names",
          "price"
        ]
      },
      "OptionBuilderHints": {
        "type": "object",
        "properties": {
          "placement": {
            "type": "boolean"
          },
          "amount": {
            "maxItems": 2,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "light",
                "extra"
              ]
            }
          }
        }
      },
      "Product": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "names": {
            "$ref": "#/components/schemas/Localized"
          },
          "descriptions": {
            "$ref": "#/components/schemas/Localized"
          },
          "image": {
            "type": "string"
          },
          "categoryId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "kind": {
            "type": "string",
            "enum": [
              "simple",
              "bundle"
            ]
          },
          "basePrice": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          },
          "groupIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "sizeFamily": {
            "type": "object",
            "properties": {
              "familyId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "size": {
                "type": "string",
                "enum": [
                  "medium",
                  "large"
                ]
              }
            },
            "required": [
              "familyId",
              "size"
            ]
          },
          "slices": {
            "type": "integer",
            "minimum": 1,
            "maximum": 64
          },
          "prepMinutes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "vegetarian",
                "spicy",
                "best_seller",
                "new"
              ]
            }
          },
          "sort": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "builder": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BuilderProfile"
              }
            ]
          },
          "external": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExternalRef"
              }
            ]
          }
        },
        "required": [
          "id",
          "names",
          "descriptions",
          "image",
          "categoryId",
          "kind",
          "basePrice",
          "groupIds",
          "prepMinutes",
          "tags",
          "sort"
        ]
      },
      "BuilderProfile": {
        "type": "object",
        "properties": {
          "baseArt": {
            "type": "string"
          },
          "drawnGroupIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "mode": {
            "type": "string",
            "enum": [
              "customize",
              "scratch"
            ]
          },
          "rules": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BuilderRules"
              }
            ]
          }
        },
        "required": [
          "baseArt",
          "drawnGroupIds"
        ]
      },
      "BuilderRules": {
        "type": "object",
        "properties": {
          "maxToppingsTotal": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200
          },
          "maxPerHalf": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200
          },
          "requireOneOf": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "minItems": 1,
              "maxItems": 50,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              }
            }
          },
          "forbidTogether": {
            "maxItems": 200,
            "type": "array",
            "items": {
              "minItems": 2,
              "maxItems": 2,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              }
            }
          }
        }
      },
      "BuilderArt": {
        "type": "object",
        "properties": {
          "toppings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuilderTopping"
            }
          },
          "sauces": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuilderSauce"
            }
          },
          "options": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/BuilderOptionArt"
            }
          }
        },
        "required": [
          "toppings",
          "sauces"
        ]
      },
      "BuilderTopping": {
        "type": "object",
        "properties": {
          "optionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "pieces": {
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BuilderPiece"
            }
          },
          "count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "scale": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true
          },
          "patch": {
            "type": "boolean"
          }
        },
        "required": [
          "optionId",
          "pieces",
          "count",
          "scale",
          "patch"
        ]
      },
      "BuilderPiece": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string"
          },
          "w": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true
          },
          "h": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true
          },
          "r": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true
          }
        },
        "required": [
          "file",
          "w",
          "h",
          "r"
        ]
      },
      "BuilderSauce": {
        "type": "object",
        "properties": {
          "optionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9A-F]{6}$"
          },
          "highlight": {
            "type": "string",
            "pattern": "^#[0-9A-F]{6}$"
          }
        },
        "required": [
          "optionId",
          "color",
          "highlight"
        ]
      },
      "BuilderOptionArt": {
        "type": "object",
        "properties": {
          "piece": {
            "type": "string",
            "minLength": 1
          },
          "layer": {
            "nullable": true,
            "type": "string",
            "minLength": 1
          },
          "dough": {
            "type": "string",
            "enum": [
              "classic",
              "thin",
              "pan"
            ]
          },
          "edge": {
            "type": "string",
            "enum": [
              "classic",
              "cheese",
              "garlic"
            ]
          },
          "cheese": {
            "type": "string",
            "enum": [
              "none",
              "light",
              "regular",
              "extra"
            ]
          },
          "patch": {
            "type": "string",
            "pattern": "^#[0-9A-F]{6}$"
          },
          "shape": {
            "type": "string",
            "enum": [
              "dice",
              "crumble",
              "torn",
              "shred",
              "slice",
              "crescent",
              "blob"
            ]
          },
          "drizzle": {
            "type": "string",
            "pattern": "^#[0-9A-F]{6}$"
          },
          "sprinkle": {
            "type": "string",
            "pattern": "^#[0-9A-F]{6}$"
          },
          "highlight": {
            "type": "string",
            "pattern": "^#[0-9A-F]{6}$"
          },
          "vessel": {
            "type": "string",
            "enum": [
              "squeeze_bottle",
              "oil_cruet"
            ]
          },
          "tint": {
            "type": "string",
            "pattern": "^#[0-9A-F]{6}$"
          },
          "count": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "size": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true
          },
          "post": {
            "type": "boolean"
          },
          "pre": {
            "type": "boolean"
          },
          "thin": {
            "type": "boolean"
          }
        }
      },
      "PartnerOrderPayments": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "paymentMethod": {
            "type": "string",
            "enum": [
              "pay_at_branch",
              "cash_on_delivery",
              "online"
            ]
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          },
          "paid": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          },
          "refunded": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          },
          "attempts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "status": {
                  "type": "string"
                },
                "amount": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                }
              },
              "required": [
                "id",
                "status",
                "amount",
                "createdAt"
              ]
            }
          },
          "refunds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Refund"
            }
          }
        },
        "required": [
          "orderId",
          "paymentMethod",
          "total",
          "paid",
          "refunded",
          "attempts",
          "refunds"
        ]
      },
      "Refund": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "orderId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "intentId": {
            "nullable": true,
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "amount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          },
          "reason": {
            "type": "string",
            "enum": [
              "cancelled_by_customer",
              "cancelled_by_branch",
              "rejected",
              "item_unavailable",
              "quality",
              "other"
            ]
          },
          "note": {
            "type": "string",
            "maxLength": 500
          },
          "status": {
            "type": "string",
            "enum": [
              "requested",
              "processing",
              "succeeded",
              "failed"
            ]
          },
          "requestedBy": {
            "type": "string",
            "minLength": 1
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "settledAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "id",
          "orderId",
          "intentId",
          "amount",
          "reason",
          "status",
          "requestedBy",
          "createdAt"
        ]
      },
      "WebhookEventType": {
        "type": "string",
        "enum": [
          "order.created",
          "order.accepted",
          "order.preparing",
          "order.ready",
          "order.out_for_delivery",
          "order.delivered",
          "order.picked_up",
          "order.cancelled",
          "order.rejected",
          "order.failed_delivery",
          "order.not_collected",
          "order.ack_overdue",
          "payment.succeeded",
          "payment.refunded",
          "invoice.issued",
          "branch.closed",
          "branch.opened",
          "branch.busy",
          "availability.changed",
          "catalog.published",
          "ping"
        ]
      },
      "WebhookDeliveryStatus": {
        "type": "string",
        "enum": [
          "pending",
          "delivered",
          "failed",
          "dead"
        ]
      },
      "WebhookPauseReason": {
        "type": "string",
        "enum": [
          "manual",
          "failures"
        ]
      },
      "SaveWebhookRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "url": {
            "type": "string",
            "minLength": 8,
            "maxLength": 500
          },
          "events": {
            "minItems": 1,
            "maxItems": 21,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEventType"
            }
          },
          "branches": {
            "nullable": true,
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "pii": {
            "type": "boolean"
          },
          "active": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "url",
          "events"
        ]
      },
      "WebhookSubscription": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEventType"
            }
          },
          "branches": {
            "nullable": true,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "pii": {
            "type": "boolean"
          },
          "active": {
            "type": "boolean"
          },
          "pausedAt": {
            "nullable": true,
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "pausedReason": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/WebhookPauseReason"
              }
            ]
          },
          "secretHint": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "createdBy": {
            "nullable": true,
            "type": "string"
          },
          "partnerId": {
            "nullable": true,
            "type": "string"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "lastDeliveryAt": {
            "nullable": true,
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "failureCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "waiting": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "dead": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "name",
          "url",
          "events",
          "branches",
          "pii",
          "active",
          "pausedAt",
          "pausedReason",
          "secretHint",
          "createdAt",
          "createdBy",
          "partnerId",
          "updatedAt",
          "lastDeliveryAt",
          "failureCount",
          "waiting",
          "dead"
        ]
      },
      "WebhookSecretIssued": {
        "type": "object",
        "properties": {
          "subscription": {
            "$ref": "#/components/schemas/WebhookSubscription"
          },
          "secret": {
            "type": "string"
          }
        },
        "required": [
          "subscription",
          "secret"
        ]
      },
      "WebhookDelivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "subscriptionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "eventId": {
            "nullable": true,
            "type": "string"
          },
          "eventType": {
            "$ref": "#/components/schemas/WebhookEventType"
          },
          "subject": {
            "nullable": true,
            "type": "string"
          },
          "branchId": {
            "nullable": true,
            "type": "string"
          },
          "attempt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "status": {
            "$ref": "#/components/schemas/WebhookDeliveryStatus"
          },
          "httpStatus": {
            "nullable": true,
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "durationMs": {
            "nullable": true,
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "error": {
            "nullable": true,
            "type": "string"
          },
          "nextAt": {
            "nullable": true,
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "lastAttemptAt": {
            "nullable": true,
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "deliveredAt": {
            "nullable": true,
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "replayOf": {
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "id",
          "subscriptionId",
          "eventId",
          "eventType",
          "subject",
          "branchId",
          "attempt",
          "status",
          "httpStatus",
          "durationMs",
          "error",
          "nextAt",
          "createdAt",
          "lastAttemptAt",
          "deliveredAt",
          "replayOf"
        ]
      },
      "WebhookDeliveryPage": {
        "type": "object",
        "properties": {
          "deliveries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookDelivery"
            }
          },
          "nextBefore": {
            "type": "string"
          }
        },
        "required": [
          "deliveries"
        ]
      },
      "PartnerMenu": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "full",
              "delta"
            ]
          },
          "dryRun": {
            "type": "boolean"
          },
          "categories": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 50
                },
                "nameAr": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "nameEn": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "sortOrder": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "blocked": {
                  "type": "boolean"
                }
              },
              "required": [
                "code",
                "nameAr",
                "nameEn"
              ]
            }
          },
          "items": {
            "maxItems": 3000,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 50
                },
                "nameAr": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "nameEn": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "descriptionAr": {
                  "type": "string",
                  "maxLength": 500
                },
                "descriptionEn": {
                  "type": "string",
                  "maxLength": 500
                },
                "categoryCode": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 50
                },
                "price": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "variants": {
                  "maxItems": 10,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 50
                      },
                      "price": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "blocked": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "code",
                      "price"
                    ]
                  }
                },
                "groupCodes": {
                  "maxItems": 50,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 50
                  }
                },
                "blocked": {
                  "type": "boolean"
                }
              },
              "required": [
                "code",
                "nameAr",
                "nameEn"
              ]
            }
          },
          "groups": {
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 50
                },
                "nameAr": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "nameEn": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "minSelect": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "maxSelect": {
                  "nullable": true,
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "maxPerOption": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "options": {
                  "maxItems": 200,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 50
                      },
                      "nameAr": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "nameEn": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "price": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "pricesBySize": {
                        "type": "object",
                        "properties": {
                          "medium": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "large": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        }
                      },
                      "blocked": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "code",
                      "nameAr",
                      "nameEn",
                      "price"
                    ]
                  }
                }
              },
              "required": [
                "code",
                "nameAr",
                "nameEn",
                "options"
              ]
            }
          }
        },
        "required": [
          "mode"
        ]
      },
      "CatalogImportStatus": {
        "type": "string",
        "enum": [
          "rejected",
          "staged",
          "published",
          "discarded",
          "superseded"
        ]
      },
      "CatalogImportUnknown": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "category",
              "item",
              "variant",
              "group",
              "option"
            ]
          },
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "price": {
            "nullable": true,
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "kind",
          "code",
          "name",
          "price"
        ]
      },
      "CatalogImport": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "partnerId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "env": {
            "$ref": "#/components/schemas/IntegrationMode"
          },
          "mode": {
            "type": "string",
            "enum": [
              "full",
              "delta"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/CatalogImportStatus"
          },
          "reason": {
            "nullable": true,
            "type": "string"
          },
          "counts": {
            "type": "object",
            "properties": {
              "categories": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "items": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "groups": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "options": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "applied": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "unknown": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "takenOff": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "categories",
              "items",
              "groups",
              "options",
              "applied",
              "unknown",
              "takenOff"
            ]
          },
          "unknown": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogImportUnknown"
            }
          },
          "takenOff": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogIssue"
            }
          },
          "diff": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/CatalogDiff"
              }
            ]
          },
          "versionId": {
            "nullable": true,
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "decidedAt": {
            "nullable": true,
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "decidedBy": {
            "nullable": true,
            "type": "string"
          }
        },
        "required": [
          "id",
          "partnerId",
          "env",
          "mode",
          "status",
          "reason",
          "counts",
          "unknown",
          "takenOff",
          "issues",
          "diff",
          "versionId",
          "createdAt",
          "decidedAt",
          "decidedBy"
        ]
      },
      "CatalogIssue": {
        "type": "object",
        "properties": {
          "severity": {
            "type": "string",
            "enum": [
              "error",
              "warning"
            ]
          },
          "code": {
            "type": "string"
          },
          "ref": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "severity",
          "code",
          "ref"
        ]
      },
      "CatalogDiff": {
        "type": "object",
        "properties": {
          "productsAdded": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "productsRemoved": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "productsChanged": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "priceChanges": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "productId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "from": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
                },
                "to": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
                }
              },
              "required": [
                "productId",
                "from",
                "to"
              ]
            }
          },
          "optionPriceChanges": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "groupId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "optionId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "size": {
                  "type": "string",
                  "enum": [
                    "medium",
                    "large"
                  ]
                },
                "from": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
                },
                "to": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
                }
              },
              "required": [
                "groupId",
                "optionId",
                "from",
                "to"
              ]
            }
          },
          "groupsAdded": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "groupsRemoved": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "groupsChanged": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "categoriesChanged": {
            "type": "boolean"
          }
        },
        "required": [
          "productsAdded",
          "productsRemoved",
          "productsChanged",
          "priceChanges",
          "optionPriceChanges",
          "groupsAdded",
          "groupsRemoved",
          "groupsChanged",
          "categoriesChanged"
        ]
      },
      "PartnerAvailabilityItem": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "product",
              "option"
            ]
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "variant": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "available": {
            "type": "boolean"
          }
        },
        "required": [
          "kind",
          "available"
        ]
      },
      "PartnerAvailabilityRequest": {
        "type": "object",
        "properties": {
          "items": {
            "maxItems": 2000,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartnerAvailabilityItem"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "PartnerAvailabilityResult": {
        "type": "object",
        "properties": {
          "branchId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "off": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "on": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "keptStaff": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "unknown": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "unavailable": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "product",
                    "option"
                  ]
                },
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                }
              },
              "required": [
                "kind",
                "id"
              ]
            }
          }
        },
        "required": [
          "branchId",
          "off",
          "on",
          "keptStaff",
          "unknown",
          "unavailable"
        ]
      },
      "PartnerPushMessage": {
        "type": "object",
        "properties": {
          "version": {
            "type": "number",
            "enum": [
              1
            ]
          },
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "order.created",
              "order.cancelled"
            ]
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "partnerId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "data": {
            "type": "object",
            "properties": {
              "order": {
                "$ref": "#/components/schemas/PartnerOrder"
              }
            },
            "required": [
              "order"
            ]
          }
        },
        "required": [
          "version",
          "id",
          "type",
          "occurredAt",
          "partnerId",
          "data"
        ]
      },
      "PartnerPushAnswer": {
        "type": "object",
        "properties": {
          "externalOrderNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "externalReceiptNo": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          }
        }
      },
      "PartnerDayBranch": {
        "type": "object",
        "properties": {
          "branchId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "externalCode": {
            "nullable": true,
            "type": "string"
          },
          "orders": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "served": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "ended": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "open": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "servedTotal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          },
          "refunded": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
          }
        },
        "required": [
          "branchId",
          "externalCode",
          "orders",
          "served",
          "ended",
          "open",
          "servedTotal",
          "refunded"
        ]
      },
      "PartnerDailyReport": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "branches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartnerDayBranch"
            }
          },
          "orders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "orderId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "number": {
                  "type": "string"
                },
                "branchId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending_payment",
                    "payment_failed",
                    "placed",
                    "accepted",
                    "preparing",
                    "ready",
                    "out_for_delivery",
                    "delivered",
                    "picked_up",
                    "cancelled",
                    "rejected",
                    "delivery_failed",
                    "not_collected"
                  ]
                },
                "total": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
                },
                "externalOrderNo": {
                  "nullable": true,
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                }
              },
              "required": [
                "orderId",
                "number",
                "branchId",
                "status",
                "total",
                "externalOrderNo",
                "createdAt"
              ]
            }
          }
        },
        "required": [
          "date",
          "branches",
          "orders"
        ]
      },
      "PartnerReconciliationRequest": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "branches": {
            "minItems": 1,
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "branchId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "served": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "servedTotal": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in halalas (1 riyal = 100), VAT-inclusive"
                },
                "externalOrderNos": {
                  "maxItems": 5000,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 50
                  }
                }
              },
              "required": [
                "branchId",
                "served",
                "servedTotal"
              ]
            }
          }
        },
        "required": [
          "date",
          "branches"
        ]
      },
      "PartnerReconciliation": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string"
          },
          "matched": {
            "type": "boolean"
          },
          "branches": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "branchId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "ours": {
                  "type": "object",
                  "properties": {
                    "served": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "servedTotal": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "served",
                    "servedTotal"
                  ]
                },
                "theirs": {
                  "type": "object",
                  "properties": {
                    "served": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "servedTotal": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "served",
                    "servedTotal"
                  ]
                },
                "matched": {
                  "type": "boolean"
                },
                "missingAtPartner": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "unknownAtLp": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "branchId",
                "ours",
                "theirs",
                "matched",
                "missingAtPartner",
                "unknownAtLp"
              ]
            }
          }
        },
        "required": [
          "date",
          "matched",
          "branches"
        ]
      },
      "PartnerTokenRequest": {
        "type": "object",
        "properties": {
          "grant_type": {
            "type": "string",
            "maxLength": 40
          },
          "client_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "client_secret": {
            "type": "string",
            "minLength": 10,
            "maxLength": 200
          },
          "scope": {
            "type": "string",
            "maxLength": 500
          }
        },
        "required": [
          "grant_type",
          "client_id",
          "client_secret"
        ]
      },
      "PartnerTokenResponse": {
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string"
          },
          "token_type": {
            "type": "string",
            "enum": [
              "Bearer"
            ]
          },
          "expires_in": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "scope": {
            "type": "string"
          }
        },
        "required": [
          "access_token",
          "token_type",
          "expires_in",
          "scope"
        ]
      },
      "PartnerSandboxOrderRequest": {
        "type": "object",
        "properties": {
          "branchId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "fulfilment": {
            "type": "string",
            "enum": [
              "pickup",
              "delivery"
            ]
          },
          "lines": {
            "minItems": 1,
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CartLine"
            }
          },
          "paymentMethod": {
            "type": "string",
            "enum": [
              "pay_at_branch",
              "cash_on_delivery"
            ]
          },
          "delivery": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DeliveryDetails"
              }
            ]
          }
        },
        "required": [
          "branchId",
          "fulfilment"
        ]
      },
      "PartnerRequestLogRow": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "requestId": {
            "type": "string"
          },
          "keyId": {
            "nullable": true,
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "keyPrefix": {
            "nullable": true,
            "type": "string"
          },
          "env": {
            "$ref": "#/components/schemas/IntegrationMode"
          },
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "errorCode": {
            "nullable": true,
            "type": "string"
          },
          "durationMs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "ip": {
            "nullable": true,
            "type": "string"
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "id",
          "requestId",
          "keyId",
          "keyPrefix",
          "env",
          "method",
          "path",
          "status",
          "errorCode",
          "durationMs",
          "ip",
          "at"
        ]
      },
      "PartnerRequestLogPage": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartnerRequestLogRow"
            }
          },
          "nextBefore": {
            "nullable": true,
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "items",
          "nextBefore"
        ]
      }
    },
    "securitySchemes": {
      "partnerKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A partner key: `lpk_test_…` (sandbox) or `lpk_live_…` (production)."
      }
    }
  }
}
