{
    "openapi": "3.0.3",
    "info": {
        "title": "AloYemek Entegrasyon API",
        "version": "1.0.0",
        "description": "POS ve entegrasyon firmaları için AloYemek restoran API'si. Belgeler: https://developers.aloyemek.com",
        "contact": {
            "email": "destek@aloyemek.com"
        }
    },
    "servers": [
        {
            "url": "https://www.aloyemek.com/aloapi/v1"
        }
    ],
    "tags": [
        {
            "name": "Kimlik doğrulama",
            "description": "Uygulama ve restoran anahtarıyla token alın; tüm isteklerde Authorization: Bearer &lt;token&gt; başlığını gönderin."
        },
        {
            "name": "Restoran",
            "description": "Restoran bilgileri, çalışma saatleri ve sipariş alımını açma / durdurma. İzin: restaurant."
        },
        {
            "name": "Menü",
            "description": "Menüyü okuyun, ürün ve seçenekleri tükendi / satışta yapın, fiyat güncelleyin. İzin: menu."
        },
        {
            "name": "Siparişler",
            "description": "Aktif siparişleri alın ve sipariş durumunu yönetin. İzin: orders. Her sipariş nesnesindeki availableActions, o an çağırabileceğiniz işlemleri listeler."
        },
        {
            "name": "Raporlar",
            "description": "Geçmiş siparişler ve toplamlar. İzin: reports."
        }
    ],
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer"
            }
        }
    },
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "paths": {
        "/auth/login": {
            "post": {
                "tags": [
                    "Kimlik doğrulama"
                ],
                "operationId": "auth-login",
                "summary": "Giriş yap (token al)",
                "description": "Onaylı firmanın appSecretKey değeri ile restoranın panelinden oluşturduğu restaurantSecretKey değerini gönderin. Dönen token 24 saat geçerlidir; süre dolunca veya 401 aldığınızda tekrar giriş yapın. Her restoran için ayrı token alınır.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "appSecretKey": {
                                        "type": "string",
                                        "description": "Firmanıza onayda verilen uygulama anahtarı (ayk_app_…)."
                                    },
                                    "restaurantSecretKey": {
                                        "type": "string",
                                        "description": "Restoranın AloYemek panelinde “API entegrasyonları” sayfasından oluşturduğu anahtar (ayk_rst_…)."
                                    }
                                },
                                "required": [
                                    "appSecretKey",
                                    "restaurantSecretKey"
                                ]
                            },
                            "example": {
                                "appSecretKey": "ayk_app_2f6c…",
                                "restaurantSecretKey": "ayk_rst_6fa7…"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "token": "9f1c2b7e…",
                                        "tokenType": "Bearer",
                                        "expiresAt": "2026-09-18T17:19:13+03:00",
                                        "expiresIn": 86400,
                                        "restaurantId": "0b484214-4740-407b-b3ec-d3987e6f1bb4",
                                        "scopes": [
                                            "restaurant",
                                            "menu",
                                            "orders",
                                            "reports"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "VALIDATION_ERROR"
                    },
                    "401": {
                        "description": "INVALID_CREDENTIALS"
                    },
                    "403": {
                        "description": "CONNECTION_REVOKED"
                    },
                    "429": {
                        "description": "RATE_LIMITED"
                    }
                },
                "security": []
            }
        },
        "/me": {
            "get": {
                "tags": [
                    "Kimlik doğrulama"
                ],
                "operationId": "me",
                "summary": "Bağlantı bilgisi",
                "description": "Token'ın hangi restorana ait olduğunu ve bağlantının güncel izinlerini döner. Restoran izinleri istediği an değiştirebildiği için uygulamanız açılırken çağırmanız önerilir.",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "restaurantId": "0b484214-4740-407b-b3ec-d3987e6f1bb4",
                                        "integrator": "Örnek POS Yazılım A.Ş.",
                                        "scopes": [
                                            "restaurant",
                                            "menu",
                                            "orders",
                                            "reports"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "TOKEN_EXPIRED"
                    }
                }
            }
        },
        "/restaurant": {
            "get": {
                "tags": [
                    "Restoran"
                ],
                "operationId": "restaurant-get",
                "summary": "Restoran bilgisi",
                "description": "Restoranın adı, adresi, konumu, logosu ve anlık sipariş durumu. ordering.open false ise restoran şu an sipariş almıyordur: paused restoranın kendisinin durdurduğunu, closedByAdmin AloYemek tarafından kapatıldığını gösterir.",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "id": "0b484214-4740-407b-b3ec-d3987e6f1bb4",
                                        "name": "Çiğ Köftecim 70",
                                        "slug": "cig-koftecim-70-merkez-alisahane-mah",
                                        "url": "https://www.aloyemek.com/cig-koftecim-70-merkez-alisahane-mah",
                                        "phone": "+903380000000",
                                        "address": {
                                            "full": "Alişahane, Karaman/Karaman, Türkiye",
                                            "city": "Merkez",
                                            "state": "Karaman",
                                            "postalCode": "70100",
                                            "latitude": 37.18532689999999973906597006134688854217529296875,
                                            "longitude": 33.21080450000000183763404493220150470733642578125
                                        },
                                        "logo": "https://www.aloyemek.com/upload/40066/0594d6df-38ed-4744-badb-46bcbdb2c3de.jpg",
                                        "status": "active",
                                        "services": [
                                            "delivery",
                                            "pickup"
                                        ],
                                        "ordering": {
                                            "open": true,
                                            "paused": false,
                                            "pausedUntil": null,
                                            "pauseReason": "",
                                            "closedByAdmin": false
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "FORBIDDEN_SCOPE"
                    }
                }
            }
        },
        "/restaurant/working-hours": {
            "get": {
                "tags": [
                    "Restoran"
                ],
                "operationId": "restaurant-hours",
                "summary": "Çalışma saatleri",
                "description": "Haftalık çalışma saatleri. Aynı gün için birden fazla satır olabilir (ör. gece yarısını geçen vardiya). dayOfWeek: 1 = Pazartesi … 7 = Pazar. Saatler restoranın yerel saatidir (Europe/Istanbul).",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "day": "monday",
                                            "dayOfWeek": 1,
                                            "open": true,
                                            "start": "11:00",
                                            "end": "23:59",
                                            "start2": null,
                                            "end2": null,
                                            "note": "",
                                            "serviceType": null
                                        },
                                        {
                                            "day": "tuesday",
                                            "dayOfWeek": 2,
                                            "open": true,
                                            "start": "11:00",
                                            "end": "23:59",
                                            "start2": null,
                                            "end2": null,
                                            "note": "",
                                            "serviceType": null
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "FORBIDDEN_SCOPE"
                    }
                }
            }
        },
        "/restaurant/close": {
            "post": {
                "tags": [
                    "Restoran"
                ],
                "operationId": "restaurant-close",
                "summary": "Sipariş alımını durdur",
                "description": "Restoranı belirtilen süre boyunca yeni siparişlere kapatır (AloYemek panelindeki “Siparişleri durdur” ile aynıdır). Süre dolunca restoran otomatik olarak yeniden sipariş almaya başlar.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "minutes": {
                                        "type": "integer",
                                        "description": "Durdurma süresi, dakika (5 – 1440)."
                                    },
                                    "reason": {
                                        "type": "string",
                                        "description": "Durdurma nedeni (en fazla 190 karakter), ör. “Yoğunluk”."
                                    }
                                },
                                "required": [
                                    "minutes"
                                ]
                            },
                            "example": {
                                "minutes": 30,
                                "reason": "Yoğunluk"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "id": "0b484214-4740-407b-b3ec-d3987e6f1bb4",
                                        "name": "Çiğ Köftecim 70",
                                        "slug": "cig-koftecim-70-merkez-alisahane-mah",
                                        "url": "https://www.aloyemek.com/cig-koftecim-70-merkez-alisahane-mah",
                                        "phone": "+903380000000",
                                        "address": {
                                            "full": "Alişahane, Karaman/Karaman, Türkiye",
                                            "city": "Merkez",
                                            "state": "Karaman",
                                            "postalCode": "70100",
                                            "latitude": 37.18532689999999973906597006134688854217529296875,
                                            "longitude": 33.21080450000000183763404493220150470733642578125
                                        },
                                        "logo": "https://www.aloyemek.com/upload/40066/0594d6df-38ed-4744-badb-46bcbdb2c3de.jpg",
                                        "status": "active",
                                        "services": [
                                            "delivery",
                                            "pickup"
                                        ],
                                        "ordering": {
                                            "open": false,
                                            "paused": true,
                                            "pausedUntil": "2026-09-17T17:49:28+03:00",
                                            "pauseReason": "Yoğunluk",
                                            "closedByAdmin": false
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "VALIDATION_ERROR"
                    },
                    "403": {
                        "description": "FORBIDDEN_SCOPE"
                    }
                }
            }
        },
        "/restaurant/open": {
            "post": {
                "tags": [
                    "Restoran"
                ],
                "operationId": "restaurant-open",
                "summary": "Sipariş alımını aç",
                "description": "Durdurulmuş sipariş alımını hemen yeniden açar. AloYemek tarafından kapatılmış (closedByAdmin) bir restoranı açmaz.",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "id": "0b484214-4740-407b-b3ec-d3987e6f1bb4",
                                        "name": "Çiğ Köftecim 70",
                                        "slug": "cig-koftecim-70-merkez-alisahane-mah",
                                        "url": "https://www.aloyemek.com/cig-koftecim-70-merkez-alisahane-mah",
                                        "phone": "+903380000000",
                                        "address": {
                                            "full": "Alişahane, Karaman/Karaman, Türkiye",
                                            "city": "Merkez",
                                            "state": "Karaman",
                                            "postalCode": "70100",
                                            "latitude": 37.18532689999999973906597006134688854217529296875,
                                            "longitude": 33.21080450000000183763404493220150470733642578125
                                        },
                                        "logo": "https://www.aloyemek.com/upload/40066/0594d6df-38ed-4744-badb-46bcbdb2c3de.jpg",
                                        "status": "active",
                                        "services": [
                                            "delivery",
                                            "pickup"
                                        ],
                                        "ordering": {
                                            "open": true,
                                            "paused": false,
                                            "pausedUntil": null,
                                            "pauseReason": "",
                                            "closedByAdmin": false
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "FORBIDDEN_SCOPE"
                    }
                }
            }
        },
        "/menu": {
            "get": {
                "tags": [
                    "Menü"
                ],
                "operationId": "menu-get",
                "summary": "Menüyü getir",
                "description": "Kategoriler, ürünler, porsiyon/boy fiyatları ve seçenek grupları. Bir ürün birden fazla kategoride yer alabilir. active false ürün menüde gizlidir; available false ürün görünür ama “tükendi”dir. Ürün eşleştirmesi için id (kalıcı) veya sku kullanın.",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "categories": [
                                            {
                                                "id": 14,
                                                "name": "Dürümler",
                                                "description": "",
                                                "active": true,
                                                "products": [
                                                    {
                                                        "id": 57,
                                                        "token": "4e28d318",
                                                        "name": "Çiğ Köfte Dürüm",
                                                        "description": "Lavaş, çiğ köfte, yeşillik",
                                                        "image": "https://www.aloyemek.com/upload/40066/urun.jpg",
                                                        "sku": "CK-DRM",
                                                        "active": true,
                                                        "available": true,
                                                        "unavailableUntil": null,
                                                        "sizes": [
                                                            {
                                                                "id": 57,
                                                                "name": "Büyük",
                                                                "price": 100,
                                                                "discount": 0,
                                                                "discountType": "fixed",
                                                                "discountStart": null,
                                                                "discountEnd": null,
                                                                "available": true,
                                                                "sku": ""
                                                            }
                                                        ],
                                                        "optionGroups": [
                                                            {
                                                                "id": 1,
                                                                "name": "Ekstralar",
                                                                "sizeId": 57,
                                                                "type": "multiple",
                                                                "min": 0,
                                                                "max": 2,
                                                                "required": false,
                                                                "options": [
                                                                    {
                                                                        "id": 1,
                                                                        "name": "Acı sos",
                                                                        "price": 5,
                                                                        "available": true
                                                                    }
                                                                ]
                                                            }
                                                        ]
                                                    }
                                                ]
                                            }
                                        ],
                                        "productCount": 1
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "FORBIDDEN_SCOPE"
                    }
                }
            }
        },
        "/products/{productId}/status": {
            "post": {
                "tags": [
                    "Menü"
                ],
                "operationId": "product-status",
                "summary": "Ürünü tükendi / satışta yap",
                "description": "available: false ile ürünü satışa kapatır. minutes verirseniz ürün o süre sonunda otomatik olarak satışa döner; vermezseniz siz açana kadar kapalı kalır (panelde “süresiz” ile aynı, ürün menüde gizlenir). available: true ürünü hemen satışa açar.",
                "parameters": [
                    {
                        "name": "productId",
                        "in": "path",
                        "required": true,
                        "description": "Menüdeki ürün id değeri.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "available": {
                                        "type": "boolean",
                                        "description": "true: satışta, false: tükendi."
                                    },
                                    "minutes": {
                                        "type": "integer",
                                        "description": "Yalnız available: false ile; kaç dakika sonra otomatik açılsın (en fazla 43200)."
                                    }
                                },
                                "required": [
                                    "available"
                                ]
                            },
                            "example": {
                                "available": false,
                                "minutes": 60
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "id": 57,
                                        "active": true,
                                        "available": false,
                                        "unavailableUntil": "2026-09-17T18:19:20+03:00"
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "NOT_FOUND"
                    },
                    "422": {
                        "description": "VALIDATION_ERROR"
                    },
                    "403": {
                        "description": "FORBIDDEN_SCOPE"
                    }
                }
            }
        },
        "/products/{productId}/price": {
            "post": {
                "tags": [
                    "Menü"
                ],
                "operationId": "product-price",
                "summary": "Ürün fiyatını güncelle",
                "description": "Ürünün satış fiyatını günceller (KDV dahil, TL). Ürünün birden fazla boyu varsa sizeId zorunludur. İndirimli fiyatlar bu uçla değişmez.",
                "parameters": [
                    {
                        "name": "productId",
                        "in": "path",
                        "required": true,
                        "description": "Ürün id değeri.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "price": {
                                        "type": "number",
                                        "description": "Yeni fiyat (0 – 1000000)."
                                    },
                                    "sizeId": {
                                        "type": "integer",
                                        "description": "sizes[].id; tek boylu üründe gönderilmeyebilir."
                                    }
                                },
                                "required": [
                                    "price"
                                ]
                            },
                            "example": {
                                "price": 120.5,
                                "sizeId": 57
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "productId": 57,
                                        "sizeId": 57,
                                        "price": 120.5
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "NOT_FOUND"
                    },
                    "422": {
                        "description": "VALIDATION_ERROR"
                    },
                    "403": {
                        "description": "FORBIDDEN_SCOPE"
                    }
                }
            }
        },
        "/options/{optionId}/status": {
            "post": {
                "tags": [
                    "Menü"
                ],
                "operationId": "option-status",
                "summary": "Seçeneği tükendi / satışta yap",
                "description": "Ürün seçeneğini (ek malzeme, sos, içecek seçimi vb.) satışa açar veya kapatır. Seçenek, onu kullanan tüm ürünlerde birlikte değişir.",
                "parameters": [
                    {
                        "name": "optionId",
                        "in": "path",
                        "required": true,
                        "description": "optionGroups[].options[].id değeri.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "available": {
                                        "type": "boolean",
                                        "description": "true: satışta, false: tükendi."
                                    }
                                },
                                "required": [
                                    "available"
                                ]
                            },
                            "example": {
                                "available": false
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "id": 1,
                                        "name": "Acı sos",
                                        "price": 5,
                                        "available": false
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "NOT_FOUND"
                    },
                    "422": {
                        "description": "VALIDATION_ERROR"
                    },
                    "403": {
                        "description": "FORBIDDEN_SCOPE"
                    }
                }
            }
        },
        "/options/{optionId}/price": {
            "post": {
                "tags": [
                    "Menü"
                ],
                "operationId": "option-price",
                "summary": "Seçenek fiyatını güncelle",
                "description": "Seçeneğin ek ücretini günceller.",
                "parameters": [
                    {
                        "name": "optionId",
                        "in": "path",
                        "required": true,
                        "description": "Seçenek id değeri.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "price": {
                                        "type": "number",
                                        "description": "Yeni ek ücret (0 – 1000000)."
                                    }
                                },
                                "required": [
                                    "price"
                                ]
                            },
                            "example": {
                                "price": 7
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "id": 1,
                                        "name": "Acı sos",
                                        "price": 7,
                                        "available": true
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "NOT_FOUND"
                    },
                    "422": {
                        "description": "VALIDATION_ERROR"
                    },
                    "403": {
                        "description": "FORBIDDEN_SCOPE"
                    }
                }
            }
        },
        "/orders/active": {
            "get": {
                "tags": [
                    "Siparişler"
                ],
                "operationId": "orders-active",
                "summary": "Aktif siparişler",
                "description": "Yeni, hazırlanan ve hazır durumdaki siparişler (en yeni önce, en fazla 200). Webhook kullanmıyorsanız bu ucu 15–30 saniyede bir çağırın; webhook kullanıyorsanız yalnız uygulama açılışında ve bağlantı koptuktan sonra eşitleme için çağırmanız yeterlidir.",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "id": "ad136e9a-9e62-43a5-a739-246ad09ab3dc",
                                            "number": 10018,
                                            "reference": "",
                                            "restaurantId": "0b484214-4740-407b-b3ec-d3987e6f1bb4",
                                            "status": "new",
                                            "statusGroup": "new",
                                            "availableActions": [
                                                "accept",
                                                "reject",
                                                "ready"
                                            ],
                                            "type": "delivery",
                                            "createdAt": "2026-09-17T17:18:19+03:00",
                                            "updatedAt": "2026-09-17T17:18:19+03:00",
                                            "acceptedAt": null,
                                            "scheduled": false,
                                            "deliveryDate": "2026-09-17",
                                            "deliveryTime": null,
                                            "deliveryTimeEnd": null,
                                            "payment": {
                                                "method": "cod",
                                                "name": "Kapıda ödeme",
                                                "status": "unpaid"
                                            },
                                            "currency": "TRY",
                                            "total": 105,
                                            "customer": {
                                                "name": "Ayşe Yılmaz",
                                                "phone": "+905551112233"
                                            },
                                            "address": {
                                                "formatted": "Yurt Mah. 71412 Sk. No:5 D:3, Çukurova/Adana",
                                                "address1": "No:5 D:3",
                                                "address2": "",
                                                "label": "Ev",
                                                "locationName": "",
                                                "postalCode": "",
                                                "latitude": 37.05120000000000146656020660884678363800048828125,
                                                "longitude": 35.28609999999999757847035652957856655120849609375,
                                                "instructions": "Zili çalmayın",
                                                "deliveryOption": ""
                                            },
                                            "table": null,
                                            "includeUtensils": true,
                                            "cashChangeFor": 200,
                                            "rejectionReason": null,
                                            "items": [
                                                {
                                                    "row": "a1c9916bbe59ba79",
                                                    "productId": 57,
                                                    "name": "Çiğ Köfte Dürüm",
                                                    "sku": "CK-DRM",
                                                    "category": "Dürümler",
                                                    "sizeId": 57,
                                                    "sizeName": "Büyük",
                                                    "quantity": 1,
                                                    "unitPrice": 100,
                                                    "discount": 0,
                                                    "discountType": "",
                                                    "total": 100,
                                                    "free": false,
                                                    "note": "Az acılı",
                                                    "ifSoldOut": "",
                                                    "options": [
                                                        {
                                                            "groupId": 1,
                                                            "groupName": "Ekstralar",
                                                            "id": 1,
                                                            "name": "Acı sos",
                                                            "quantity": 1,
                                                            "price": 5,
                                                            "total": 5
                                                        }
                                                    ],
                                                    "attributes": []
                                                }
                                            ],
                                            "totals": {
                                                "subtotal": 105,
                                                "discount": 0,
                                                "promoCode": "",
                                                "promoTotal": 0,
                                                "offerTotal": 0,
                                                "deliveryFee": 0,
                                                "serviceFee": 0,
                                                "smallOrderFee": 0,
                                                "packagingFee": 0,
                                                "tip": 0,
                                                "tax": 0,
                                                "pointsUsed": 0,
                                                "walletUsed": 0,
                                                "total": 105,
                                                "amountDue": 105
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "FORBIDDEN_SCOPE"
                    }
                }
            }
        },
        "/orders/{orderId}": {
            "get": {
                "tags": [
                    "Siparişler"
                ],
                "operationId": "orders-get",
                "summary": "Sipariş detayı",
                "description": "Siparişin tüm ayrıntıları: müşteri, teslimat adresi, ürünler ve seçenekleri, notlar, ödeme ve tutarlar. statusGroup değerleri: new, preparing, ready, completed, cancelled, other.",
                "parameters": [
                    {
                        "name": "orderId",
                        "in": "path",
                        "required": true,
                        "description": "Siparişin id değeri.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "id": "ad136e9a-9e62-43a5-a739-246ad09ab3dc",
                                        "number": 10018,
                                        "reference": "",
                                        "restaurantId": "0b484214-4740-407b-b3ec-d3987e6f1bb4",
                                        "status": "new",
                                        "statusGroup": "new",
                                        "availableActions": [
                                            "accept",
                                            "reject",
                                            "ready"
                                        ],
                                        "type": "delivery",
                                        "createdAt": "2026-09-17T17:18:19+03:00",
                                        "updatedAt": "2026-09-17T17:18:19+03:00",
                                        "acceptedAt": null,
                                        "scheduled": false,
                                        "deliveryDate": "2026-09-17",
                                        "deliveryTime": null,
                                        "deliveryTimeEnd": null,
                                        "payment": {
                                            "method": "cod",
                                            "name": "Kapıda ödeme",
                                            "status": "unpaid"
                                        },
                                        "currency": "TRY",
                                        "total": 105,
                                        "customer": {
                                            "name": "Ayşe Yılmaz",
                                            "phone": "+905551112233"
                                        },
                                        "address": {
                                            "formatted": "Yurt Mah. 71412 Sk. No:5 D:3, Çukurova/Adana",
                                            "address1": "No:5 D:3",
                                            "address2": "",
                                            "label": "Ev",
                                            "locationName": "",
                                            "postalCode": "",
                                            "latitude": 37.05120000000000146656020660884678363800048828125,
                                            "longitude": 35.28609999999999757847035652957856655120849609375,
                                            "instructions": "Zili çalmayın",
                                            "deliveryOption": ""
                                        },
                                        "table": null,
                                        "includeUtensils": true,
                                        "cashChangeFor": 200,
                                        "rejectionReason": null,
                                        "items": [
                                            {
                                                "row": "a1c9916bbe59ba79",
                                                "productId": 57,
                                                "name": "Çiğ Köfte Dürüm",
                                                "sku": "CK-DRM",
                                                "category": "Dürümler",
                                                "sizeId": 57,
                                                "sizeName": "Büyük",
                                                "quantity": 1,
                                                "unitPrice": 100,
                                                "discount": 0,
                                                "discountType": "",
                                                "total": 100,
                                                "free": false,
                                                "note": "Az acılı",
                                                "ifSoldOut": "",
                                                "options": [
                                                    {
                                                        "groupId": 1,
                                                        "groupName": "Ekstralar",
                                                        "id": 1,
                                                        "name": "Acı sos",
                                                        "quantity": 1,
                                                        "price": 5,
                                                        "total": 5
                                                    }
                                                ],
                                                "attributes": []
                                            }
                                        ],
                                        "totals": {
                                            "subtotal": 105,
                                            "discount": 0,
                                            "promoCode": "",
                                            "promoTotal": 0,
                                            "offerTotal": 0,
                                            "deliveryFee": 0,
                                            "serviceFee": 0,
                                            "smallOrderFee": 0,
                                            "packagingFee": 0,
                                            "tip": 0,
                                            "tax": 0,
                                            "pointsUsed": 0,
                                            "walletUsed": 0,
                                            "total": 105,
                                            "amountDue": 105
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "NOT_FOUND"
                    },
                    "403": {
                        "description": "FORBIDDEN_SCOPE"
                    }
                }
            }
        },
        "/orders/{orderId}/accept": {
            "post": {
                "tags": [
                    "Siparişler"
                ],
                "operationId": "orders-accept",
                "summary": "Siparişi kabul et",
                "description": "Yeni siparişi kabul eder; müşteri bildirim alır ve sipariş “hazırlanıyor” olur. Yanıt, işlemden sonraki güncel sipariş nesnesidir (bkz. Sipariş detayı).",
                "parameters": [
                    {
                        "name": "orderId",
                        "in": "path",
                        "required": true,
                        "description": "Sipariş id.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "id": "ad136e9a-9e62-43a5-a739-246ad09ab3dc",
                                        "number": 10018,
                                        "reference": "",
                                        "restaurantId": "0b484214-4740-407b-b3ec-d3987e6f1bb4",
                                        "status": "accepted",
                                        "statusGroup": "preparing",
                                        "availableActions": [
                                            "reject",
                                            "ready",
                                            "on-the-way",
                                            "delivered"
                                        ],
                                        "type": "delivery",
                                        "createdAt": "2026-09-17T17:18:19+03:00",
                                        "updatedAt": "2026-09-17T17:19:37+03:00",
                                        "acceptedAt": "2026-09-17T17:20:36+03:00",
                                        "scheduled": false,
                                        "deliveryDate": "2026-09-17",
                                        "deliveryTime": null,
                                        "deliveryTimeEnd": null,
                                        "payment": {
                                            "method": "cod",
                                            "name": "Kapıda ödeme",
                                            "status": "unpaid"
                                        },
                                        "currency": "TRY",
                                        "total": 105,
                                        "customer": {
                                            "name": "Ayşe Yılmaz",
                                            "phone": "+905551112233"
                                        },
                                        "address": {
                                            "formatted": "Yurt Mah. 71412 Sk. No:5 D:3, Çukurova/Adana",
                                            "address1": "No:5 D:3",
                                            "address2": "",
                                            "label": "Ev",
                                            "locationName": "",
                                            "postalCode": "",
                                            "latitude": 37.05120000000000146656020660884678363800048828125,
                                            "longitude": 35.28609999999999757847035652957856655120849609375,
                                            "instructions": "Zili çalmayın",
                                            "deliveryOption": ""
                                        },
                                        "table": null,
                                        "includeUtensils": true,
                                        "cashChangeFor": 200,
                                        "rejectionReason": null,
                                        "items": [
                                            {
                                                "row": "a1c9916bbe59ba79",
                                                "productId": 57,
                                                "name": "Çiğ Köfte Dürüm",
                                                "sku": "CK-DRM",
                                                "category": "Dürümler",
                                                "sizeId": 57,
                                                "sizeName": "Büyük",
                                                "quantity": 1,
                                                "unitPrice": 100,
                                                "discount": 0,
                                                "discountType": "",
                                                "total": 100,
                                                "free": false,
                                                "note": "Az acılı",
                                                "ifSoldOut": "",
                                                "options": [
                                                    {
                                                        "groupId": 1,
                                                        "groupName": "Ekstralar",
                                                        "id": 1,
                                                        "name": "Acı sos",
                                                        "quantity": 1,
                                                        "price": 5,
                                                        "total": 5
                                                    }
                                                ],
                                                "attributes": []
                                            }
                                        ],
                                        "totals": {
                                            "subtotal": 105,
                                            "discount": 0,
                                            "promoCode": "",
                                            "promoTotal": 0,
                                            "offerTotal": 0,
                                            "deliveryFee": 0,
                                            "serviceFee": 0,
                                            "smallOrderFee": 0,
                                            "packagingFee": 0,
                                            "tip": 0,
                                            "tax": 0,
                                            "pointsUsed": 0,
                                            "walletUsed": 0,
                                            "total": 105,
                                            "amountDue": 105
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "SAME_STATUS"
                    },
                    "404": {
                        "description": "NOT_FOUND"
                    }
                }
            }
        },
        "/orders/{orderId}/reject": {
            "post": {
                "tags": [
                    "Siparişler"
                ],
                "operationId": "orders-reject",
                "summary": "Siparişi reddet / iptal et",
                "description": "Siparişi neden belirterek reddeder. Yeni, hazırlanan veya hazır siparişlerde kullanılabilir. Online ödenmiş siparişlerde iade süreci AloYemek tarafından yürütülür. Hazır nedenler için Red nedenleri ucunu kullanın. Yanıt, işlemden sonraki güncel sipariş nesnesidir (bkz. Sipariş detayı).",
                "parameters": [
                    {
                        "name": "orderId",
                        "in": "path",
                        "required": true,
                        "description": "Sipariş id.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "reason": {
                                        "type": "string",
                                        "description": "Red nedeni (en fazla 255 karakter); müşteriye gösterilir."
                                    }
                                },
                                "required": [
                                    "reason"
                                ]
                            },
                            "example": {
                                "reason": "Kitchen closed"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "id": "ad136e9a-9e62-43a5-a739-246ad09ab3dc",
                                        "number": 10018,
                                        "reference": "",
                                        "restaurantId": "0b484214-4740-407b-b3ec-d3987e6f1bb4",
                                        "status": "rejected",
                                        "statusGroup": "cancelled",
                                        "availableActions": [],
                                        "type": "delivery",
                                        "createdAt": "2026-09-17T17:18:19+03:00",
                                        "updatedAt": "2026-09-17T17:18:19+03:00",
                                        "acceptedAt": null,
                                        "scheduled": false,
                                        "deliveryDate": "2026-09-17",
                                        "deliveryTime": null,
                                        "deliveryTimeEnd": null,
                                        "payment": {
                                            "method": "cod",
                                            "name": "Kapıda ödeme",
                                            "status": "unpaid"
                                        },
                                        "currency": "TRY",
                                        "total": 105,
                                        "customer": {
                                            "name": "Ayşe Yılmaz",
                                            "phone": "+905551112233"
                                        },
                                        "address": {
                                            "formatted": "Yurt Mah. 71412 Sk. No:5 D:3, Çukurova/Adana",
                                            "address1": "No:5 D:3",
                                            "address2": "",
                                            "label": "Ev",
                                            "locationName": "",
                                            "postalCode": "",
                                            "latitude": 37.05120000000000146656020660884678363800048828125,
                                            "longitude": 35.28609999999999757847035652957856655120849609375,
                                            "instructions": "Zili çalmayın",
                                            "deliveryOption": ""
                                        },
                                        "table": null,
                                        "includeUtensils": true,
                                        "cashChangeFor": 200,
                                        "rejectionReason": "Kitchen closed",
                                        "items": [
                                            {
                                                "row": "a1c9916bbe59ba79",
                                                "productId": 57,
                                                "name": "Çiğ Köfte Dürüm",
                                                "sku": "CK-DRM",
                                                "category": "Dürümler",
                                                "sizeId": 57,
                                                "sizeName": "Büyük",
                                                "quantity": 1,
                                                "unitPrice": 100,
                                                "discount": 0,
                                                "discountType": "",
                                                "total": 100,
                                                "free": false,
                                                "note": "Az acılı",
                                                "ifSoldOut": "",
                                                "options": [
                                                    {
                                                        "groupId": 1,
                                                        "groupName": "Ekstralar",
                                                        "id": 1,
                                                        "name": "Acı sos",
                                                        "quantity": 1,
                                                        "price": 5,
                                                        "total": 5
                                                    }
                                                ],
                                                "attributes": []
                                            }
                                        ],
                                        "totals": {
                                            "subtotal": 105,
                                            "discount": 0,
                                            "promoCode": "",
                                            "promoTotal": 0,
                                            "offerTotal": 0,
                                            "deliveryFee": 0,
                                            "serviceFee": 0,
                                            "smallOrderFee": 0,
                                            "packagingFee": 0,
                                            "tip": 0,
                                            "tax": 0,
                                            "pointsUsed": 0,
                                            "walletUsed": 0,
                                            "total": 105,
                                            "amountDue": 105
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "VALIDATION_ERROR"
                    },
                    "409": {
                        "description": "INVALID_STATUS_TRANSITION"
                    },
                    "404": {
                        "description": "NOT_FOUND"
                    }
                }
            }
        },
        "/orders/{orderId}/ready": {
            "post": {
                "tags": [
                    "Siparişler"
                ],
                "operationId": "orders-ready",
                "summary": "Sipariş hazır",
                "description": "Siparişi “hazır” yapar (kurye veya müşteri teslim almaya gelebilir). Yanıt, işlemden sonraki güncel sipariş nesnesidir (bkz. Sipariş detayı).",
                "parameters": [
                    {
                        "name": "orderId",
                        "in": "path",
                        "required": true,
                        "description": "Sipariş id.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "id": "ad136e9a-9e62-43a5-a739-246ad09ab3dc",
                                        "number": 10018,
                                        "reference": "",
                                        "restaurantId": "0b484214-4740-407b-b3ec-d3987e6f1bb4",
                                        "status": "ready for pickup",
                                        "statusGroup": "ready",
                                        "availableActions": [
                                            "reject",
                                            "on-the-way",
                                            "delivered",
                                            "delivery-failed"
                                        ],
                                        "type": "delivery",
                                        "createdAt": "2026-09-17T17:18:19+03:00",
                                        "updatedAt": "2026-09-17T17:19:37+03:00",
                                        "acceptedAt": "2026-09-17T17:20:36+03:00",
                                        "scheduled": false,
                                        "deliveryDate": "2026-09-17",
                                        "deliveryTime": null,
                                        "deliveryTimeEnd": null,
                                        "payment": {
                                            "method": "cod",
                                            "name": "Kapıda ödeme",
                                            "status": "unpaid"
                                        },
                                        "currency": "TRY",
                                        "total": 105,
                                        "customer": {
                                            "name": "Ayşe Yılmaz",
                                            "phone": "+905551112233"
                                        },
                                        "address": {
                                            "formatted": "Yurt Mah. 71412 Sk. No:5 D:3, Çukurova/Adana",
                                            "address1": "No:5 D:3",
                                            "address2": "",
                                            "label": "Ev",
                                            "locationName": "",
                                            "postalCode": "",
                                            "latitude": 37.05120000000000146656020660884678363800048828125,
                                            "longitude": 35.28609999999999757847035652957856655120849609375,
                                            "instructions": "Zili çalmayın",
                                            "deliveryOption": ""
                                        },
                                        "table": null,
                                        "includeUtensils": true,
                                        "cashChangeFor": 200,
                                        "rejectionReason": null,
                                        "items": [
                                            {
                                                "row": "a1c9916bbe59ba79",
                                                "productId": 57,
                                                "name": "Çiğ Köfte Dürüm",
                                                "sku": "CK-DRM",
                                                "category": "Dürümler",
                                                "sizeId": 57,
                                                "sizeName": "Büyük",
                                                "quantity": 1,
                                                "unitPrice": 100,
                                                "discount": 0,
                                                "discountType": "",
                                                "total": 100,
                                                "free": false,
                                                "note": "Az acılı",
                                                "ifSoldOut": "",
                                                "options": [
                                                    {
                                                        "groupId": 1,
                                                        "groupName": "Ekstralar",
                                                        "id": 1,
                                                        "name": "Acı sos",
                                                        "quantity": 1,
                                                        "price": 5,
                                                        "total": 5
                                                    }
                                                ],
                                                "attributes": []
                                            }
                                        ],
                                        "totals": {
                                            "subtotal": 105,
                                            "discount": 0,
                                            "promoCode": "",
                                            "promoTotal": 0,
                                            "offerTotal": 0,
                                            "deliveryFee": 0,
                                            "serviceFee": 0,
                                            "smallOrderFee": 0,
                                            "packagingFee": 0,
                                            "tip": 0,
                                            "tax": 0,
                                            "pointsUsed": 0,
                                            "walletUsed": 0,
                                            "total": 105,
                                            "amountDue": 105
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "INVALID_STATUS_TRANSITION"
                    },
                    "404": {
                        "description": "NOT_FOUND"
                    }
                }
            }
        },
        "/orders/{orderId}/on-the-way": {
            "post": {
                "tags": [
                    "Siparişler"
                ],
                "operationId": "orders-on-the-way",
                "summary": "Sipariş yolda",
                "description": "Yalnız paket servis (type: delivery) siparişlerinde; restoranın kendi kuryesi yola çıktığında çağrılır. Yanıt, işlemden sonraki güncel sipariş nesnesidir (bkz. Sipariş detayı).",
                "parameters": [
                    {
                        "name": "orderId",
                        "in": "path",
                        "required": true,
                        "description": "Sipariş id.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "id": "ad136e9a-9e62-43a5-a739-246ad09ab3dc",
                                        "number": 10018,
                                        "reference": "",
                                        "restaurantId": "0b484214-4740-407b-b3ec-d3987e6f1bb4",
                                        "status": "delivery on its way",
                                        "statusGroup": "ready",
                                        "availableActions": [
                                            "reject",
                                            "delivered",
                                            "delivery-failed"
                                        ],
                                        "type": "delivery",
                                        "createdAt": "2026-09-17T17:18:19+03:00",
                                        "updatedAt": "2026-09-17T17:19:37+03:00",
                                        "acceptedAt": "2026-09-17T17:20:36+03:00",
                                        "scheduled": false,
                                        "deliveryDate": "2026-09-17",
                                        "deliveryTime": null,
                                        "deliveryTimeEnd": null,
                                        "payment": {
                                            "method": "cod",
                                            "name": "Kapıda ödeme",
                                            "status": "unpaid"
                                        },
                                        "currency": "TRY",
                                        "total": 105,
                                        "customer": {
                                            "name": "Ayşe Yılmaz",
                                            "phone": "+905551112233"
                                        },
                                        "address": {
                                            "formatted": "Yurt Mah. 71412 Sk. No:5 D:3, Çukurova/Adana",
                                            "address1": "No:5 D:3",
                                            "address2": "",
                                            "label": "Ev",
                                            "locationName": "",
                                            "postalCode": "",
                                            "latitude": 37.05120000000000146656020660884678363800048828125,
                                            "longitude": 35.28609999999999757847035652957856655120849609375,
                                            "instructions": "Zili çalmayın",
                                            "deliveryOption": ""
                                        },
                                        "table": null,
                                        "includeUtensils": true,
                                        "cashChangeFor": 200,
                                        "rejectionReason": null,
                                        "items": [
                                            {
                                                "row": "a1c9916bbe59ba79",
                                                "productId": 57,
                                                "name": "Çiğ Köfte Dürüm",
                                                "sku": "CK-DRM",
                                                "category": "Dürümler",
                                                "sizeId": 57,
                                                "sizeName": "Büyük",
                                                "quantity": 1,
                                                "unitPrice": 100,
                                                "discount": 0,
                                                "discountType": "",
                                                "total": 100,
                                                "free": false,
                                                "note": "Az acılı",
                                                "ifSoldOut": "",
                                                "options": [
                                                    {
                                                        "groupId": 1,
                                                        "groupName": "Ekstralar",
                                                        "id": 1,
                                                        "name": "Acı sos",
                                                        "quantity": 1,
                                                        "price": 5,
                                                        "total": 5
                                                    }
                                                ],
                                                "attributes": []
                                            }
                                        ],
                                        "totals": {
                                            "subtotal": 105,
                                            "discount": 0,
                                            "promoCode": "",
                                            "promoTotal": 0,
                                            "offerTotal": 0,
                                            "deliveryFee": 0,
                                            "serviceFee": 0,
                                            "smallOrderFee": 0,
                                            "packagingFee": 0,
                                            "tip": 0,
                                            "tax": 0,
                                            "pointsUsed": 0,
                                            "walletUsed": 0,
                                            "total": 105,
                                            "amountDue": 105
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "INVALID_STATUS_TRANSITION"
                    },
                    "404": {
                        "description": "NOT_FOUND"
                    }
                }
            }
        },
        "/orders/{orderId}/delivered": {
            "post": {
                "tags": [
                    "Siparişler"
                ],
                "operationId": "orders-delivered",
                "summary": "Sipariş teslim edildi",
                "description": "Paket servis siparişini teslim edildi olarak kapatır. Yanıt, işlemden sonraki güncel sipariş nesnesidir (bkz. Sipariş detayı).",
                "parameters": [
                    {
                        "name": "orderId",
                        "in": "path",
                        "required": true,
                        "description": "Sipariş id.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "id": "ad136e9a-9e62-43a5-a739-246ad09ab3dc",
                                        "number": 10018,
                                        "reference": "",
                                        "restaurantId": "0b484214-4740-407b-b3ec-d3987e6f1bb4",
                                        "status": "delivered",
                                        "statusGroup": "completed",
                                        "availableActions": [],
                                        "type": "delivery",
                                        "createdAt": "2026-09-17T17:18:19+03:00",
                                        "updatedAt": "2026-09-17T17:19:37+03:00",
                                        "acceptedAt": "2026-09-17T17:20:36+03:00",
                                        "scheduled": false,
                                        "deliveryDate": "2026-09-17",
                                        "deliveryTime": null,
                                        "deliveryTimeEnd": null,
                                        "payment": {
                                            "method": "cod",
                                            "name": "Kapıda ödeme",
                                            "status": "unpaid"
                                        },
                                        "currency": "TRY",
                                        "total": 105,
                                        "customer": {
                                            "name": "Ayşe Yılmaz",
                                            "phone": "+905551112233"
                                        },
                                        "address": {
                                            "formatted": "Yurt Mah. 71412 Sk. No:5 D:3, Çukurova/Adana",
                                            "address1": "No:5 D:3",
                                            "address2": "",
                                            "label": "Ev",
                                            "locationName": "",
                                            "postalCode": "",
                                            "latitude": 37.05120000000000146656020660884678363800048828125,
                                            "longitude": 35.28609999999999757847035652957856655120849609375,
                                            "instructions": "Zili çalmayın",
                                            "deliveryOption": ""
                                        },
                                        "table": null,
                                        "includeUtensils": true,
                                        "cashChangeFor": 200,
                                        "rejectionReason": null,
                                        "items": [
                                            {
                                                "row": "a1c9916bbe59ba79",
                                                "productId": 57,
                                                "name": "Çiğ Köfte Dürüm",
                                                "sku": "CK-DRM",
                                                "category": "Dürümler",
                                                "sizeId": 57,
                                                "sizeName": "Büyük",
                                                "quantity": 1,
                                                "unitPrice": 100,
                                                "discount": 0,
                                                "discountType": "",
                                                "total": 100,
                                                "free": false,
                                                "note": "Az acılı",
                                                "ifSoldOut": "",
                                                "options": [
                                                    {
                                                        "groupId": 1,
                                                        "groupName": "Ekstralar",
                                                        "id": 1,
                                                        "name": "Acı sos",
                                                        "quantity": 1,
                                                        "price": 5,
                                                        "total": 5
                                                    }
                                                ],
                                                "attributes": []
                                            }
                                        ],
                                        "totals": {
                                            "subtotal": 105,
                                            "discount": 0,
                                            "promoCode": "",
                                            "promoTotal": 0,
                                            "offerTotal": 0,
                                            "deliveryFee": 0,
                                            "serviceFee": 0,
                                            "smallOrderFee": 0,
                                            "packagingFee": 0,
                                            "tip": 0,
                                            "tax": 0,
                                            "pointsUsed": 0,
                                            "walletUsed": 0,
                                            "total": 105,
                                            "amountDue": 105
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "INVALID_STATUS_TRANSITION"
                    },
                    "404": {
                        "description": "NOT_FOUND"
                    }
                }
            }
        },
        "/orders/{orderId}/complete": {
            "post": {
                "tags": [
                    "Siparişler"
                ],
                "operationId": "orders-complete",
                "summary": "Sipariş tamamlandı (gel-al / masada)",
                "description": "Gel-al (pickup) ve masada (dinein) siparişleri tamamlar. Yanıt, işlemden sonraki güncel sipariş nesnesidir (bkz. Sipariş detayı).",
                "parameters": [
                    {
                        "name": "orderId",
                        "in": "path",
                        "required": true,
                        "description": "Sipariş id.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "id": "ad136e9a-9e62-43a5-a739-246ad09ab3dc",
                                        "number": 10018,
                                        "reference": "",
                                        "restaurantId": "0b484214-4740-407b-b3ec-d3987e6f1bb4",
                                        "status": "complete",
                                        "statusGroup": "completed",
                                        "availableActions": [],
                                        "type": "pickup",
                                        "createdAt": "2026-09-17T17:18:19+03:00",
                                        "updatedAt": "2026-09-17T17:19:37+03:00",
                                        "acceptedAt": "2026-09-17T17:20:36+03:00",
                                        "scheduled": false,
                                        "deliveryDate": "2026-09-17",
                                        "deliveryTime": null,
                                        "deliveryTimeEnd": null,
                                        "payment": {
                                            "method": "cod",
                                            "name": "Kapıda ödeme",
                                            "status": "unpaid"
                                        },
                                        "currency": "TRY",
                                        "total": 105,
                                        "customer": {
                                            "name": "Ayşe Yılmaz",
                                            "phone": "+905551112233"
                                        },
                                        "address": null,
                                        "table": null,
                                        "includeUtensils": true,
                                        "cashChangeFor": 200,
                                        "rejectionReason": null,
                                        "items": [
                                            {
                                                "row": "a1c9916bbe59ba79",
                                                "productId": 57,
                                                "name": "Çiğ Köfte Dürüm",
                                                "sku": "CK-DRM",
                                                "category": "Dürümler",
                                                "sizeId": 57,
                                                "sizeName": "Büyük",
                                                "quantity": 1,
                                                "unitPrice": 100,
                                                "discount": 0,
                                                "discountType": "",
                                                "total": 100,
                                                "free": false,
                                                "note": "Az acılı",
                                                "ifSoldOut": "",
                                                "options": [
                                                    {
                                                        "groupId": 1,
                                                        "groupName": "Ekstralar",
                                                        "id": 1,
                                                        "name": "Acı sos",
                                                        "quantity": 1,
                                                        "price": 5,
                                                        "total": 5
                                                    }
                                                ],
                                                "attributes": []
                                            }
                                        ],
                                        "totals": {
                                            "subtotal": 105,
                                            "discount": 0,
                                            "promoCode": "",
                                            "promoTotal": 0,
                                            "offerTotal": 0,
                                            "deliveryFee": 0,
                                            "serviceFee": 0,
                                            "smallOrderFee": 0,
                                            "packagingFee": 0,
                                            "tip": 0,
                                            "tax": 0,
                                            "pointsUsed": 0,
                                            "walletUsed": 0,
                                            "total": 105,
                                            "amountDue": 105
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "INVALID_STATUS_TRANSITION"
                    },
                    "404": {
                        "description": "NOT_FOUND"
                    }
                }
            }
        },
        "/orders/{orderId}/delivery-failed": {
            "post": {
                "tags": [
                    "Siparişler"
                ],
                "operationId": "orders-delivery-failed",
                "summary": "Teslimat başarısız",
                "description": "Hazır veya yoldaki paket servis siparişi müşteriye ulaştırılamadığında çağrılır. Yanıt, işlemden sonraki güncel sipariş nesnesidir (bkz. Sipariş detayı).",
                "parameters": [
                    {
                        "name": "orderId",
                        "in": "path",
                        "required": true,
                        "description": "Sipariş id.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "id": "ad136e9a-9e62-43a5-a739-246ad09ab3dc",
                                        "number": 10018,
                                        "reference": "",
                                        "restaurantId": "0b484214-4740-407b-b3ec-d3987e6f1bb4",
                                        "status": "delivery failed",
                                        "statusGroup": "cancelled",
                                        "availableActions": [],
                                        "type": "delivery",
                                        "createdAt": "2026-09-17T17:18:19+03:00",
                                        "updatedAt": "2026-09-17T17:19:37+03:00",
                                        "acceptedAt": "2026-09-17T17:20:36+03:00",
                                        "scheduled": false,
                                        "deliveryDate": "2026-09-17",
                                        "deliveryTime": null,
                                        "deliveryTimeEnd": null,
                                        "payment": {
                                            "method": "cod",
                                            "name": "Kapıda ödeme",
                                            "status": "unpaid"
                                        },
                                        "currency": "TRY",
                                        "total": 105,
                                        "customer": {
                                            "name": "Ayşe Yılmaz",
                                            "phone": "+905551112233"
                                        },
                                        "address": {
                                            "formatted": "Yurt Mah. 71412 Sk. No:5 D:3, Çukurova/Adana",
                                            "address1": "No:5 D:3",
                                            "address2": "",
                                            "label": "Ev",
                                            "locationName": "",
                                            "postalCode": "",
                                            "latitude": 37.05120000000000146656020660884678363800048828125,
                                            "longitude": 35.28609999999999757847035652957856655120849609375,
                                            "instructions": "Zili çalmayın",
                                            "deliveryOption": ""
                                        },
                                        "table": null,
                                        "includeUtensils": true,
                                        "cashChangeFor": 200,
                                        "rejectionReason": null,
                                        "items": [
                                            {
                                                "row": "a1c9916bbe59ba79",
                                                "productId": 57,
                                                "name": "Çiğ Köfte Dürüm",
                                                "sku": "CK-DRM",
                                                "category": "Dürümler",
                                                "sizeId": 57,
                                                "sizeName": "Büyük",
                                                "quantity": 1,
                                                "unitPrice": 100,
                                                "discount": 0,
                                                "discountType": "",
                                                "total": 100,
                                                "free": false,
                                                "note": "Az acılı",
                                                "ifSoldOut": "",
                                                "options": [
                                                    {
                                                        "groupId": 1,
                                                        "groupName": "Ekstralar",
                                                        "id": 1,
                                                        "name": "Acı sos",
                                                        "quantity": 1,
                                                        "price": 5,
                                                        "total": 5
                                                    }
                                                ],
                                                "attributes": []
                                            }
                                        ],
                                        "totals": {
                                            "subtotal": 105,
                                            "discount": 0,
                                            "promoCode": "",
                                            "promoTotal": 0,
                                            "offerTotal": 0,
                                            "deliveryFee": 0,
                                            "serviceFee": 0,
                                            "smallOrderFee": 0,
                                            "packagingFee": 0,
                                            "tip": 0,
                                            "tax": 0,
                                            "pointsUsed": 0,
                                            "walletUsed": 0,
                                            "total": 105,
                                            "amountDue": 105
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "INVALID_STATUS_TRANSITION"
                    },
                    "404": {
                        "description": "NOT_FOUND"
                    }
                }
            }
        },
        "/orders/reject-reasons": {
            "get": {
                "tags": [
                    "Siparişler"
                ],
                "operationId": "orders-reasons",
                "summary": "Red nedenleri",
                "description": "AloYemek'te tanımlı hazır red nedenleri. Kullanıcıya liste olarak gösterip seçileni reason alanında gönderebilirsiniz.",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": [
                                        "Ürün kalmadı",
                                        "Mutfak kapalı",
                                        "Restoran çok yoğun",
                                        "Müşteri iptal etmek için aradı",
                                        "Diğer"
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "FORBIDDEN_SCOPE"
                    }
                }
            }
        },
        "/orders/history": {
            "get": {
                "tags": [
                    "Raporlar"
                ],
                "operationId": "orders-history",
                "summary": "Sipariş geçmişi",
                "description": "Tarih aralığındaki siparişlerin özet listesi (sayfa başına 50) ve toplamlar. Aralık en fazla 62 gündür; tarih verilmezse son 7 gün döner.",
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "Başlangıç tarihi.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "Bitiş tarihi (dahil).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Sayfa numarası, 1'den başlar.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "success": true,
                                    "data": {
                                        "from": "2026-09-11",
                                        "to": "2026-09-17",
                                        "page": 1,
                                        "perPage": 50,
                                        "totalCount": 1,
                                        "pageCount": 1,
                                        "summary": {
                                            "count": 1,
                                            "completedCount": 1,
                                            "cancelledCount": 0,
                                            "completedTotal": 105
                                        },
                                        "orders": [
                                            {
                                                "id": "ad136e9a-9e62-43a5-a739-246ad09ab3dc",
                                                "number": 10018,
                                                "reference": "",
                                                "restaurantId": "0b484214-4740-407b-b3ec-d3987e6f1bb4",
                                                "status": "delivered",
                                                "statusGroup": "completed",
                                                "availableActions": [],
                                                "type": "delivery",
                                                "createdAt": "2026-09-17T17:18:19+03:00",
                                                "updatedAt": "2026-09-17T17:19:53+03:00",
                                                "acceptedAt": "2026-09-17T17:20:36+03:00",
                                                "scheduled": false,
                                                "deliveryDate": "2026-09-17",
                                                "deliveryTime": null,
                                                "deliveryTimeEnd": null,
                                                "payment": {
                                                    "method": "cod",
                                                    "name": "Kapıda ödeme",
                                                    "status": "unpaid"
                                                },
                                                "currency": "TRY",
                                                "total": 105
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "VALIDATION_ERROR"
                    },
                    "403": {
                        "description": "FORBIDDEN_SCOPE"
                    }
                }
            }
        }
    }
}