{
  "info": {
    "_postman_id": "8b53544e-5af3-4f04-a8ff-08f15c52453a",
    "name": "RMS API Complete (v1) - Updated",
    "description": "Comprehensive RMS API collection on /api/v1 with latest auth branch-context flow (allowed_branches, active_branch_id, requires_branch_selection, select-branch endpoint), Order Sessions, Payment Methods, and Payments validation.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{bearer_token}}",
        "type": "string"
      }
    ]
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "pm.request.headers.upsert({ key: 'Accept', value: 'application/json' });"
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": [
          "pm.test('Response time < 5s', function () {",
          "  pm.expect(pm.response.responseTime).to.be.below(5000);",
          "});"
        ]
      }
    }
  ],
  "item": [
    {
      "name": "01 Auth",
      "item": [
        {
          "name": "Login",
          "request": {
            "auth": {
              "type": "noauth"
            },
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{email}}\",\n  \"password\": \"{{password}}\"\n}"
            },
            "url": "{{base_url}}/api/v1/auth/login"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Status is 200', function () { pm.response.to.have.status(200); });",
                  "const json = pm.response.json();",
                  "const token = json.token || json.access_token || (json.data && (json.data.token || json.data.access_token));",
                  "if (token) pm.environment.set('bearer_token', token);",
                  "const activeBranchId = json.active_branch_id || (json.user && json.user.active_branch_id) || null;",
                  "if (activeBranchId !== null) pm.environment.set('active_branch_id', String(activeBranchId));",
                  "const requiresSelection = !!json.requires_branch_selection;",
                  "pm.environment.set('requires_branch_selection', String(requiresSelection));",
                  "const defaultBranchId = json.default_branch_id || null;",
                  "if (defaultBranchId !== null) pm.environment.set('default_branch_id', String(defaultBranchId));",
                  "pm.test('Token stored', function () { pm.expect(pm.environment.get('bearer_token')).to.be.a('string').and.not.empty; });"
                ]
              }
            }
          ]
        },
        {
          "name": "Select Branch",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"branch_id\": {{branch_id}}\n}"
            },
            "url": "{{base_url}}/api/v1/auth/select-branch",
            "description": "Set active branch context for the authenticated user. Required when login/me indicates requires_branch_selection=true."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "if (pm.response.code === 200) {",
                  "  const json = pm.response.json();",
                  "  const activeBranchId = json.active_branch_id || (json.user && json.user.active_branch_id);",
                  "  if (activeBranchId) pm.environment.set('active_branch_id', String(activeBranchId));",
                  "}",
                  "pm.test('Status is 200/403/409', function () { pm.expect([200,403,409]).to.include(pm.response.code); });"
                ]
              }
            }
          ]
        },
        {
          "name": "Me",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/auth/me"
          }
        },
        {
          "name": "Refresh Token",
          "request": {
            "method": "POST",
            "url": "{{base_url}}/api/v1/auth/refresh"
          }
        },
        {
          "name": "Permissions",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/auth/permissions"
          }
        },
        {
          "name": "Logout",
          "request": {
            "method": "POST",
            "url": "{{base_url}}/api/v1/auth/logout"
          }
        }
      ]
    },
    {
      "name": "06 Order Sessions (NEW)",
      "item": [
        {
          "name": "Create Order Session",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"table_id\": 8,\n  \"business_day_id\": 1,\n  \"notes\": \"dine_in session\"\n}"
            },
            "url": "{{base_url}}/api/v1/order-sessions",
            "description": "Create a new order session for a table. Returns session with id, status, table info, and business_day reference."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "if ([200,201].includes(pm.response.code)) { const r=pm.response.json(); const id=r.id||(r.data&&r.data.id); if(id) pm.environment.set('order_session_id',String(id)); }"
                ]
              }
            }
          ]
        },
        {
          "name": "Get Active Session for Table",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/order-sessions/active/table/8",
            "description": "Get the active order session for a specific table. Returns session if exists and is active."
          }
        },
        {
          "name": "Get Session Summary",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/order-sessions/{{order_session_id}}/summary",
            "description": "Get session summary with order count, total amounts, payment status aggregates."
          }
        },
        {
          "name": "Get Session Entries (Activity Feed)",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/order-sessions/{{order_session_id}}/entries",
            "description": "Get session activity entries: orders added, payments received, etc."
          }
        },
        {
          "name": "Close Order Session",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"close_notes\": \"Session completed\"\n}"
            },
            "url": "{{base_url}}/api/v1/order-sessions/{{order_session_id}}/close",
            "description": "Close an order session. Session must be active and all orders settled."
          }
        }
      ]
    },
    {
      "name": "07 Tables Live Status (NEW)",
      "item": [
        {
          "name": "Get All Tables Live Status",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/tables/live-status",
            "description": "Get runtime status for all tables. Returns array with table_id, table_number, runtime_status (occupied/preparing/available), persisted_status."
          }
        },
        {
          "name": "Get Single Table Live Status",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/tables/live-status?table_id=8",
            "description": "Get runtime status for a specific table. Add ?table_id=X query param to filter single table."
          }
        }
      ]
    },
    {
      "name": "08 Payment Methods (ENHANCED)",
      "item": [
        {
          "name": "List All Payment Methods",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/payment-methods",
            "description": "Get all payment methods (active and inactive). Shows global master data with capabilities flags. Each includes branch_config for current branch.\n\nResponse fields: id, name, code, type, status, is_system_defined, capabilities (supports_customer_payments, supports_supplier_payments, etc), branch_config {is_enabled, position}"
          }
        },
        {
          "name": "List Active Payment Methods",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/payment-methods/active",
            "description": "Get active payment methods only (status=active). Filtered globally."
          }
        },
        {
          "name": "Get Available Payment Methods (by context)",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/payment-methods/available?context=customer_payments",
            "description": "Get payment methods available for a context. Filters: global active status + branch enabled + context-specific capability flags. Contexts: customer_payments, supplier_payments, internal_transfers."
          }
        },
        {
          "name": "Update Payment Method Status",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"inactive\"\n}"
            },
            "url": "{{base_url}}/api/v1/payment-methods/1/status",
            "description": "Update global payment method status (admin/manager only). Requires both admin role and capability."
          }
        },
        {
          "name": "Get Branch Payment Methods Config",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/branches/1/payment-methods",
            "description": "Get payment method configuration for a branch. Shows which payment methods are enabled/disabled and position order.\n\nResponse: array of {payment_method_id, is_enabled, position, method{id, name, code, status}}"
          }
        },
        {
          "name": "Update Branch Payment Methods",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"payment_methods\": [\n    {\n      \"payment_method_id\": 1,\n      \"is_enabled\": true,\n      \"position\": 1\n    },\n    {\n      \"payment_method_id\": 2,\n      \"is_enabled\": true,\n      \"position\": 2\n    },\n    {\n      \"payment_method_id\": 3,\n      \"is_enabled\": false,\n      \"position\": 3\n    }\n  ]\n}"
            },
            "url": "{{base_url}}/api/v1/branches/1/payment-methods",
            "description": "Sync branch payment methods. POST array of payment_method_id, is_enabled, position. Syncs entire config (upserts/deletes as needed)."
          }
        }
      ]
    },
    {
      "name": "09 Payments (ENHANCED)",
      "item": [
        {
          "name": "Create Full Payment",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"order_id\": 17,\n  \"payment_method_id\": 1,\n  \"amount\": 1575\n}"
            },
            "url": "{{base_url}}/api/v1/payments",
            "description": "Create payment for order. Validates: order exists, payment_method global supports_customer_payments=true AND branch BranchPaymentMethod.is_enabled=true. Amount <= remaining_balance. Returns payment with id, status (completed|partial), transaction_id, paid_at.\n\nResponse: {id, order_id, payment_method_id, amount, status, transaction_id, paid_at, created_at}"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "if ([200,201].includes(pm.response.code)) { const r=pm.response.json(); const id=r.id||(r.data&&r.data.id); if(id) pm.environment.set('payment_id',String(id)); }"
                ]
              }
            }
          ]
        },
        {
          "name": "Get Payment",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/payments/{{payment_id}}",
            "description": "Get payment details including order_id, amount, payment_method_id, status, transaction_id, paid_at, created_at."
          }
        },
        {
          "name": "Get Order Payment Summary",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/payments/order/17/summary",
            "description": "Get payment summary for order. Returns: total_amount, paid_amount (sum of completed+partial payments), remaining_amount, payment_status (unpaid|partial|paid), payment_history array.\n\nResponse: {order_id, total_amount, paid_amount, remaining_amount, payment_status, is_paid, payment_history[]}"
          }
        },
        {
          "name": "List All Payments",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/payments?status=completed&from_date=2026-04-01&to_date=2026-04-30",
            "description": "List payments with filters: status (pending|completed|partial|failed|refunded), from_date, to_date, order_id, customer_id, payment_method_id."
          }
        },
        {
          "name": "Update Payment Status",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"completed\"\n}"
            },
            "url": "{{base_url}}/api/v1/payments/{{payment_id}}/status",
            "description": "Update payment status. Allowed transitions: pending->completed, pending->failed, completed->refunded."
          }
        },
        {
          "name": "Refund Payment",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"reason\": \"Customer requested refund\"\n}"
            },
            "url": "{{base_url}}/api/v1/payments/{{payment_id}}/refund",
            "description": "Refund a completed payment. Transitions status to refunded and reverses payment."
          }
        },
        {
          "name": "Delete Payment",
          "request": {
            "method": "DELETE",
            "url": "{{base_url}}/api/v1/payments/{{payment_id}}",
            "description": "Soft delete payment record."
          }
        },
        {
          "name": "Restore Payment",
          "request": {
            "method": "POST",
            "url": "{{base_url}}/api/v1/payments/{{payment_id}}/restore",
            "description": "Restore soft-deleted payment."
          }
        },
        {
          "name": "Daily Payment Summary",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/payments/daily-summary?date=2026-05-12",
            "description": "Get daily payment totals by method and status."
          }
        },
        {
          "name": "Payments by Date Range",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/payments/by-date-range?from_date=2026-04-01&to_date=2026-04-30",
            "description": "Get payments within date range with optional filters."
          }
        },
        {
          "name": "Monthly Payment Summary",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/payments/monthly-summary?year=2026&month=4",
            "description": "Get monthly payment totals by method."
          }
        }
      ]
    },
    {
      "name": "06 Orders (ENHANCED with Payment Fields)",
      "item": [
        {
          "name": "List Orders",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/orders",
            "description": "List orders. Response now includes: paid_amount, remaining_amount, payment_status (unpaid|partial|paid), is_paid (boolean)."
          }
        },
        {
          "name": "Create Order",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"order_type\": \"dine_in\",\n  \"table_id\": 1,\n  \"customer_id\": 1,\n  \"customer_name\": \"Walk-in Customer\",\n  \"customer_phone\": \"0712345678\",\n  \"delivery_address\": null,\n  \"items\": [\n    {\n      \"menu_item_id\": 1,\n      \"quantity\": 2,\n      \"unit_price\": 12.5,\n      \"notes\": \"No onions\"\n    }\n  ],\n  \"notes\": \"Postman test order\",\n  \"total_amount\": 25,\n  \"discount_amount\": 0,\n  \"tax_amount\": 0\n}"
            },
            "url": "{{base_url}}/api/v1/orders"
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "if (pm.response.code === 201 || pm.response.code === 200) {",
                  "  const json = pm.response.json();",
                  "  const id = json.id || (json.data && json.data.id);",
                  "  if (id) pm.environment.set('order_id', id);",
                  "}"
                ]
              }
            }
          ]
        },
        {
          "name": "Get Order By Id",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/orders/{{order_id}}",
            "description": "Get order with NEW payment fields: paid_amount (sum of completed+partial payments), remaining_amount (total - paid_amount), payment_status (unpaid|partial|paid), is_paid (boolean).\n\nResponse: {..., order_number, total_amount, paid_amount, remaining_amount, payment_status, is_paid, ...}"
          }
        },
        {
          "name": "Get Pending Orders",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/orders/pending",
            "description": "Get orders with status=pending. Includes payment fields."
          }
        },
        {
          "name": "Get Preparing Orders",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/orders/preparing",
            "description": "Get orders with status=preparing. Includes payment fields."
          }
        },
        {
          "name": "Get Ready Orders",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/orders/ready",
            "description": "Get orders with status=ready. Includes payment fields."
          }
        },
        {
          "name": "Update Order (Full PUT)",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"order_type\": \"takeaway\",\n  \"customer_name\": \"Updated Customer\",\n  \"customer_phone\": \"0700000000\",\n  \"notes\": \"Updated via full update\",\n  \"items\": [\n    {\n      \"menu_item_id\": 1,\n      \"quantity\": 1,\n      \"unit_price\": 12.5\n    }\n  ],\n  \"total_amount\": 12.5,\n  \"discount_amount\": 0,\n  \"tax_amount\": 0\n}"
            },
            "url": "{{base_url}}/api/v1/orders/{{order_id}}"
          }
        },
        {
          "name": "Update Order Status",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"preparing\"\n}"
            },
            "url": "{{base_url}}/api/v1/orders/{{order_id}}/status"
          }
        },
        {
          "name": "Cancel Order",
          "request": {
            "method": "POST",
            "url": "{{base_url}}/api/v1/orders/{{order_id}}/cancel"
          }
        },
        {
          "name": "Delete Order (Soft Delete)",
          "request": {
            "method": "DELETE",
            "url": "{{base_url}}/api/v1/orders/{{order_id}}"
          }
        },
        {
          "name": "Restore Order",
          "request": {
            "method": "POST",
            "url": "{{base_url}}/api/v1/orders/{{order_id}}/restore"
          }
        },
        {
          "name": "Order History By Customer",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/orders/customer/{{customer_id}}"
          }
        },
        {
          "name": "Orders By Status",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/orders/status/pending"
          }
        },
        {
          "name": "Orders By Type",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/orders/type/dine_in"
          }
        },
        {
          "name": "Orders By Date Range",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/orders/by-date-range?from_date=2026-04-01&to_date=2026-04-30"
          }
        },
        {
          "name": "Get Order Receipt (Print Ready)",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/orders/receipt/{{order_id}}",
            "description": "Get order receipt formatted for printing. Includes payment summary with paid/remaining amounts."
          }
        }
      ]
    },
    {
      "name": "04 Categories",
      "item": [
        {
          "name": "List Categories",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/categories"
          }
        },
        {
          "name": "Create Category (JSON URL)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Postman Category\",\n  \"description\": \"Category from Postman\",\n  \"image_url\": \"{{uploaded_image_url}}\",\n  \"sort_order\": 1,\n  \"status\": \"active\"\n}"
            },
            "url": "{{base_url}}/api/v1/categories"
          }
        },
        {
          "name": "Get Category",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/categories/{{category_id}}"
          }
        }
      ]
    },
    {
      "name": "05 Menu Items",
      "item": [
        {
          "name": "List Menu Items",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/menu-items"
          }
        },
        {
          "name": "Create Menu Item (JSON URL)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"category_id\": {{category_id}},\n  \"name\": \"Postman Item\",\n  \"description\": \"Created from Postman\",\n  \"price\": 12.5,\n  \"image_url\": \"{{uploaded_image_url}}\",\n  \"is_vegetarian\": false,\n  \"is_vegan\": false,\n  \"is_spicy\": false,\n  \"preparation_time\": 15,\n  \"status\": \"active\"\n}"
            },
            "url": "{{base_url}}/api/v1/menu-items"
          }
        },
        {
          "name": "Get Menu Item",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/menu-items/{{menu_item_id}}"
          }
        }
      ]
    },
    {
      "name": "07 Reservations",
      "item": [
        {
          "name": "Customer - Create Reservation",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": "{{base_url}}/api/v1/customer/reservations",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"branch_id\": 1,\n  \"table_id\": 1,\n  \"customer_name\": \"John Doe\",\n  \"customer_phone\": \"01700000000\",\n  \"reservation_date\": \"2026-04-20 19:00:00\",\n  \"number_of_guests\": 4,\n  \"notes\": \"Window seat please\"\n}"
            }
          }
        },
        {
          "name": "Manager - List Reservations",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/api/v1/manager/reservations?status=pending&date=2026-04-20",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "api",
                "manager",
                "reservations"
              ],
              "query": [
                {
                  "key": "status",
                  "value": "pending"
                },
                {
                  "key": "date",
                  "value": "2026-04-20"
                }
              ]
            }
          }
        }
      ]
    },
    {
      "name": "08 Customers",
      "item": [
        {
          "name": "List Customers",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/customers"
          }
        },
        {
          "name": "Create Customer",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": "{{base_url}}/api/v1/customers",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"John Doe\",\n  \"phone\": \"01700000001\",\n  \"email\": \"john@example.com\",\n  \"status\": \"active\"\n}"
            }
          }
        },
        {
          "name": "Get Customer",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/customers/{{customer_id}}"
          }
        }
      ]
    },
    {
      "name": "14 Floors & Tables",
      "item": [
        {
          "name": "List Floors (with Tables)",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/floors/listing?include_tables=true"
          }
        },
        {
          "name": "List Tables",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/tables"
          }
        },
        {
          "name": "Available Tables",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/tables/available"
          }
        },
        {
          "name": "Occupied Tables",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/tables/occupied"
          }
        },
        {
          "name": "Get Table",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/tables/{{table_id}}"
          }
        }
      ]
    },
    {
      "name": "15 Kitchen / KDS",
      "item": [
        {
          "name": "Kitchen Dashboard",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/kitchen/dashboard"
          }
        },
        {
          "name": "Pending Orders",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/kitchen/pending"
          }
        },
        {
          "name": "Preparing Orders",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/kitchen/preparing"
          }
        },
        {
          "name": "Ready Orders",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/kitchen/ready"
          }
        }
      ]
    },
    {
      "name": "16 Inventory",
      "item": [
        {
          "name": "List Inventory",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/inventory"
          }
        },
        {
          "name": "Low Stock Items",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/inventory/low-stock"
          }
        }
      ]
    },
    {
      "name": "17 Suppliers",
      "item": [
        {
          "name": "List Suppliers",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/suppliers"
          }
        },
        {
          "name": "Active Suppliers",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/suppliers/active"
          }
        }
      ]
    },
    {
      "name": "20 Audit Logs",
      "item": [
        {
          "name": "List Audit Logs",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/audit-logs"
          }
        },
        {
          "name": "Audit Logs by User",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/audit-logs/user/1"
          }
        }
      ]
    },
    {
      "name": "21 Delivery Zones (NEW)",
      "item": [
        {
          "name": "List Delivery Zones (Active)",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/delivery-zones",
            "description": "List active delivery zones for the current user branch."
          }
        },
        {
          "name": "List Delivery Zones (Include Inactive)",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/delivery-zones?include_inactive=1",
            "description": "List all zones (active + inactive) for current branch."
          }
        },
        {
          "name": "List Delivery Zones by Branch (Admin)",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/delivery-zones?branch_id=1&include_inactive=1",
            "description": "Admin-only: list zones for a specific branch."
          }
        },
        {
          "name": "Create Delivery Zone",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"branch_id\": 1,\n  \"zone_name\": \"Zone A\",\n  \"description\": \"Main market area\",\n  \"city\": \"Lahore\",\n  \"postal_code_range\": \"54000-54100\",\n  \"delivery_charge\": 250,\n  \"is_active\": true\n}"
            },
            "url": "{{base_url}}/api/v1/delivery-zones",
            "description": "Create a new delivery zone. branch_id is optional for non-admin and defaults to user branch."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "if ([200,201].includes(pm.response.code)) {",
                  "  const r = pm.response.json();",
                  "  const id = r.id || (r.data && r.data.id);",
                  "  if (id) pm.environment.set(\"delivery_zone_id\", String(id));",
                  "}"
                ]
              }
            }
          ]
        },
        {
          "name": "Show Delivery Zone",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/api/v1/delivery-zones/{{delivery_zone_id}}"
          }
        },
        {
          "name": "Update Delivery Zone",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"zone_name\": \"Zone A Updated\",\n  \"description\": \"Updated notes\",\n  \"delivery_charge\": 300,\n  \"is_active\": true\n}"
            },
            "url": "{{base_url}}/api/v1/delivery-zones/{{delivery_zone_id}}"
          }
        },
        {
          "name": "Update Delivery Zone Status",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"is_active\": false\n}"
            },
            "url": "{{base_url}}/api/v1/delivery-zones/{{delivery_zone_id}}/status"
          }
        },
        {
          "name": "Delete Delivery Zone",
          "request": {
            "method": "DELETE",
            "url": "{{base_url}}/api/v1/delivery-zones/{{delivery_zone_id}}"
          }
        },
        {
          "name": "Restore Delivery Zone",
          "request": {
            "method": "POST",
            "url": "{{base_url}}/api/v1/delivery-zones/{{delivery_zone_id}}/restore"
          }
        }
      ]
    }
  ],
  "variable": [
    {
      "key": "base_url",
      "value": "http://127.0.0.1:8000"
    },
    {
      "key": "email",
      "value": "admin@example.com"
    },
    {
      "key": "password",
      "value": "password123"
    },
    {
      "key": "bearer_token",
      "value": ""
    },
    {
      "key": "uploaded_image_url",
      "value": "https://images.unsplash.com/photo-1540189549336-e6e99c3679fe"
    },
    {
      "key": "customer_id",
      "value": "1"
    },
    {
      "key": "category_id",
      "value": "1"
    },
    {
      "key": "menu_item_id",
      "value": "1"
    },
    {
      "key": "order_id",
      "value": "17"
    },
    {
      "key": "order_session_id",
      "value": "1"
    },
    {
      "key": "branch_id",
      "value": "1"
    },
    {
      "key": "floor_id",
      "value": "1"
    },
    {
      "key": "table_id",
      "value": "8"
    },
    {
      "key": "payment_id",
      "value": "1"
    },
    {
      "key": "payment_method_id",
      "value": "1"
    },
    {
      "key": "supplier_id",
      "value": "1"
    },
    {
      "key": "subscription_id",
      "value": "1"
    }
  ]
}
