{
  "info": {
    "name": "Booking Service API",
    "_postman_id": "booking-service-api-collection",
    "description": "Complete API collection for Booking Service with Amadeus integration support",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "http://localhost:3002",
      "type": "string"
    },
    {
      "key": "bookingId",
      "value": "1",
      "type": "string"
    },
    {
      "key": "userId",
      "value": "7",
      "type": "string",
      "description": "User ID as string"
    },
    {
      "key": "bookingReference",
      "value": "BK-12345678",
      "type": "string"
    },
    {
      "key": "authToken",
      "value": "your-jwt-token-here",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Bookings",
      "item": [
        {
          "name": "Create Booking (Without Amadeus)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{authToken}}",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"userId\": \"{{userId}}\",\n  \"hotelId\": 1,\n  \"hotelName\": \"Grand Hotel Downtown\",\n  \"hotelCity\": \"Los Angeles\",\n  \"checkInDate\": \"2026-03-15\",\n  \"checkOutDate\": \"2026-03-20\",\n  \"numberOfNights\": 5,\n  \"numberOfRooms\": 1,\n  \"numberOfAdults\": 2,\n  \"numberOfChildren\": 0,\n  \"roomType\": \"Deluxe King\",\n  \"basePrice\": 150.00,\n  \"taxesAndFees\": 30.00,\n  \"totalPrice\": 900.00,\n  \"currency\": \"USD\",\n  \"isRefundable\": true,\n  \"cancellationPolicy\": \"Free cancellation until 24 hours before check-in\",\n  \"specialRequests\": \"Late check-in after 10 PM\",\n  \"createInAmadeus\": false\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/bookings",
              "host": ["{{baseUrl}}"],
              "path": ["api", "bookings"]
            },
            "description": "Create a booking without Amadeus integration. Useful for testing or when Amadeus is not required."
          },
          "response": []
        },
        {
          "name": "Create Booking (With Amadeus)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{authToken}}",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"userId\": \"{{userId}}\",\n  \"hotelId\": 1,\n  \"amadeusHotelId\": \"HILAXJFK\",\n  \"amadeusOfferId\": \"4L8PRJPEN7\",\n  \"hotelName\": \"Grand Hotel Downtown\",\n  \"hotelCity\": \"Los Angeles\",\n  \"checkInDate\": \"2026-03-15\",\n  \"checkOutDate\": \"2026-03-20\",\n  \"numberOfNights\": 5,\n  \"numberOfRooms\": 1,\n  \"numberOfAdults\": 2,\n  \"numberOfChildren\": 0,\n  \"roomType\": \"Deluxe King\",\n  \"basePrice\": 150.00,\n  \"taxesAndFees\": 30.00,\n  \"totalPrice\": 900.00,\n  \"currency\": \"USD\",\n  \"isRefundable\": true,\n  \"cancellationPolicy\": \"Free cancellation until 24 hours before check-in\",\n  \"specialRequests\": \"Late check-in after 10 PM\",\n  \"guests\": [\n    {\n      \"tid\": 1,\n      \"title\": \"MR\",\n      \"firstName\": \"Bob\",\n      \"lastName\": \"Smith\",\n      \"phone\": \"+33679278416\",\n      \"email\": \"bob.smith@email.com\"\n    }\n  ],\n  \"payment\": {\n    \"method\": \"CREDIT_CARD\",\n    \"card\": {\n      \"vendorCode\": \"VI\",\n      \"cardNumber\": \"4151289722471370\",\n      \"expiryDate\": \"2026-08\",\n      \"holderName\": \"Bob Smith\"\n    }\n  },\n  \"officeId\": \"LAX1S242M\",\n  \"createInAmadeus\": true\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/bookings",
              "host": ["{{baseUrl}}"],
              "path": ["api", "bookings"]
            },
            "description": "Create a booking with full Amadeus integration. Requires valid offer ID from hotel search, guest information, and payment details."
          },
          "response": []
        },
        {
          "name": "Get Booking by ID",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{authToken}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/bookings/{{bookingId}}",
              "host": ["{{baseUrl}}"],
              "path": ["api", "bookings", "{{bookingId}}"]
            },
            "description": "Retrieve a specific booking by its ID."
          },
          "response": []
        },
        {
          "name": "Get Booking by Reference",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{authToken}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/bookings/reference/{{bookingReference}}",
              "host": ["{{baseUrl}}"],
              "path": ["api", "bookings", "reference", "{{bookingReference}}"]
            },
            "description": "Retrieve a booking by its booking reference number."
          },
          "response": []
        },
        {
          "name": "Get User Bookings",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{authToken}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/bookings/user/{{userId}}?page=1&limit=10&status=CONFIRMED&sortBy=createdAt&sortOrder=desc",
              "host": ["{{baseUrl}}"],
              "path": ["api", "bookings", "user", "{{userId}}"],
              "query": [
                {
                  "key": "page",
                  "value": "1",
                  "description": "Page number for pagination"
                },
                {
                  "key": "limit",
                  "value": "10",
                  "description": "Number of results per page"
                },
                {
                  "key": "status",
                  "value": "CONFIRMED",
                  "description": "Filter by status: PENDING, CONFIRMED, CANCELLED, COMPLETED",
                  "disabled": true
                },
                {
                  "key": "sortBy",
                  "value": "createdAt",
                  "description": "Sort by field: createdAt, checkInDate, totalPrice",
                  "disabled": true
                },
                {
                  "key": "sortOrder",
                  "value": "desc",
                  "description": "Sort order: asc or desc",
                  "disabled": true
                }
              ]
            },
            "description": "Get all bookings for a specific user with optional filtering and pagination."
          },
          "response": []
        },
        {
          "name": "Update Booking",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{authToken}}",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"specialRequests\": \"Early check-in at 12 PM if possible\",\n  \"numberOfAdults\": 3,\n  \"roomType\": \"Suite with Ocean View\"\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/bookings/{{bookingId}}",
              "host": ["{{baseUrl}}"],
              "path": ["api", "bookings", "{{bookingId}}"]
            },
            "description": "Update booking details. Cannot update cancelled or completed bookings."
          },
          "response": []
        },
        {
          "name": "Confirm Booking",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{authToken}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/bookings/{{bookingId}}/confirm",
              "host": ["{{baseUrl}}"],
              "path": ["api", "bookings", "{{bookingId}}", "confirm"]
            },
            "description": "Confirm a pending booking. Only PENDING bookings can be confirmed."
          },
          "response": []
        },
        {
          "name": "Cancel Booking",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{authToken}}",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"reason\": \"Change of travel plans\"\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/bookings/{{bookingId}}/cancel",
              "host": ["{{baseUrl}}"],
              "path": ["api", "bookings", "{{bookingId}}", "cancel"]
            },
            "description": "Cancel a booking. Cannot cancel completed bookings. Cancellation policy applies."
          },
          "response": []
        },
        {
          "name": "Delete Booking",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{authToken}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/bookings/{{bookingId}}",
              "host": ["{{baseUrl}}"],
              "path": ["api", "bookings", "{{bookingId}}"]
            },
            "description": "Soft delete a booking. The booking will be marked as deleted but not removed from the database."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Price & Statistics",
      "item": [
        {
          "name": "Calculate Price Breakdown",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{authToken}}",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"basePrice\": 150.00,\n  \"numberOfNights\": 5,\n  \"numberOfRooms\": 2,\n  \"taxesAndFees\": 45.00\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/bookings/calculate-price",
              "host": ["{{baseUrl}}"],
              "path": ["api", "bookings", "calculate-price"]
            },
            "description": "Calculate the total price breakdown including base price, taxes, fees, and discounts."
          },
          "response": []
        },
        {
          "name": "Get Booking Statistics",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{authToken}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/bookings/stats?userId={{userId}}",
              "host": ["{{baseUrl}}"],
              "path": ["api", "bookings", "stats"],
              "query": [
                {
                  "key": "userId",
                  "value": "{{userId}}",
                  "description": "Optional: Filter stats by user ID",
                  "disabled": true
                }
              ]
            },
            "description": "Get booking statistics including total bookings, confirmed, cancelled, completed, pending bookings, total revenue, and average booking value."
          },
          "response": []
        }
      ]
    }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{authToken}}",
        "type": "string"
      }
    ]
  }
}
