{"openapi":"3.0.3","info":{"title":"AeroLink Microservices API","description":"AeroLink is a cloud-native, microservices-based airline management platform deployed on AWS ECS Fargate.\nAll requests are routed through a CloudFront distribution backed by an Application Load Balancer with path-based routing.\n\n**Base URL:** `https://d2ehngdbowt7n2.cloudfront.net`\n\n## Services\n| Service | Stack | Path Prefix |\n|---|---|---|\n| Ports | Laravel (PHP) | `/api/ports` |\n| Flights | Laravel (PHP) | `/api/flights` |\n| Booking | Laravel (PHP) | `/api/bookings` |\n| Payment | Node.js | `/api/payments` |\n| Baggage | Node.js | `/api/baggage` |\n","version":"1.0.0","contact":{"name":"AeroLink Platform Team"}},"servers":[{"url":"https://d2ehngdbowt7n2.cloudfront.net","description":"Production (CloudFront)"},{"url":"http://aerolink-main-alb-12540221.us-east-1.elb.amazonaws.com","description":"Internal ALB (direct)"}],"tags":[{"name":"Ports","description":"Airport port/terminal management (Laravel, MySQL)"},{"name":"Flights","description":"Flight and fare management (Laravel, MySQL)"},{"name":"Bookings","description":"Passenger booking management (Laravel, MySQL)"},{"name":"Payments","description":"Payment processing via Stripe (Node.js, DynamoDB)"},{"name":"Baggage","description":"Baggage check-in tracking (Node.js, DynamoDB)"},{"name":"Health","description":"Service liveness checks"}],"paths":{"/api/ports":{"get":{"tags":["Ports"],"summary":"List all ports","description":"Returns all airport ports/terminals stored in the system.","responses":{"200":{"description":"List of ports","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Port"}}}}}}},"post":{"tags":["Ports"],"summary":"Create a new port","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortInput"},"example":{"name":"Bandaranaike International Airport","code":"CMB","country":"Sri Lanka","city":"Colombo"}}}},"responses":{"201":{"description":"Port created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Port"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/api/ports/{id}":{"put":{"tags":["Ports"],"summary":"Update a port","parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortInput"}}}},"responses":{"200":{"description":"Port updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Port"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Ports"],"summary":"Delete a port","parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Port deleted","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Port deleted successfully"}}}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/ports/health":{"get":{"tags":["Health"],"summary":"Ports service health check","responses":{"200":{"$ref":"#/components/responses/HealthOk"}}}},"/api/flights":{"get":{"tags":["Flights"],"summary":"List all flights","description":"Returns all flights and fare records.","responses":{"200":{"description":"List of flights","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Flight"}}}}}}},"post":{"tags":["Flights"],"summary":"Create a new flight","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlightInput"},"example":{"flight_number":"UL101","origin":"CMB","destination":"LHR","departure_at":"2026-07-01T08:00:00Z","arrival_at":"2026-07-01T20:00:00Z","fare":450.0}}}},"responses":{"201":{"description":"Flight created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flight"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/api/flights/{id}":{"put":{"tags":["Flights"],"summary":"Update a flight","parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlightInput"}}}},"responses":{"200":{"description":"Flight updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flight"}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"tags":["Flights"],"summary":"Delete a flight","parameters":[{"$ref":"#/components/parameters/IdParam"}],"responses":{"200":{"description":"Flight deleted","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Flight deleted successfully"}}}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/flights/health":{"get":{"tags":["Health"],"summary":"Flights service health check","responses":{"200":{"$ref":"#/components/responses/HealthOk"}}}},"/api/bookings":{"get":{"tags":["Bookings"],"summary":"List all bookings","responses":{"200":{"description":"List of bookings","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Booking"}}}}}}},"post":{"tags":["Bookings"],"summary":"Create a new booking","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingInput"},"example":{"passenger_name":"Shakeel Ahmed","flight_id":12,"seat_number":"14A","status":"confirmed"}}}},"responses":{"201":{"description":"Booking created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Booking"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/api/bookings/status/{id}":{"put":{"tags":["Bookings"],"summary":"Update booking status","description":"Updates the status of a booking. Used internally by Baggage service to verify confirmed bookings.","parameters":[{"$ref":"#/components/parameters/IdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["confirmed","cancelled","pending"]}}},"example":{"status":"confirmed"}}}},"responses":{"200":{"description":"Status updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Booking"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/bookings/health":{"get":{"tags":["Health"],"summary":"Booking service health check","responses":{"200":{"$ref":"#/components/responses/HealthOk"}}}},"/api/payments":{"post":{"tags":["Payments"],"summary":"Process a payment","description":"Charges a passenger via Stripe and records the transaction in DynamoDB.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentInput"},"example":{"booking_id":42,"amount":450.0,"currency":"USD","stripe_token":"tok_visa"}}}},"responses":{"201":{"description":"Payment successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRecord"}}}},"400":{"description":"Payment failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"$ref":"#/components/responses/ServerError"}}}},"/api/payments/health":{"get":{"tags":["Health"],"summary":"Payment service health check","responses":{"200":{"$ref":"#/components/responses/HealthOk"}}}},"/api/baggage/check-in":{"post":{"tags":["Baggage"],"summary":"Check in baggage","description":"Registers baggage for a confirmed booking. Internally calls the Booking service\nto verify booking status before persisting to DynamoDB.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaggageInput"},"example":{"booking_id":42,"baggage_tag":"TAG-2026-001","weight_kg":23.5}}}},"responses":{"201":{"description":"Baggage checked in successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Baggage tracked and logged successfully in DynamoDB."},"data":{"$ref":"#/components/schemas/BaggageRecord"}}}}}},"400":{"description":"Booking not confirmed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Baggage rejection"},"details":{"type":"string","example":"Cannot allocate baggage to a booking with status: 'pending'. Must be 'confirmed'."}}}}}},"500":{"$ref":"#/components/responses/ServerError"}}}},"/api/baggage/health":{"get":{"tags":["Health"],"summary":"Baggage service health check","responses":{"200":{"$ref":"#/components/responses/HealthOk"}}}}},"components":{"parameters":{"IdParam":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Resource ID"}},"responses":{"HealthOk":{"description":"Service is healthy","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"ok"}}}}}},"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"ValidationError":{"description":"Validation failed","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object"}}}}}},"ServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"schemas":{"ErrorResponse":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}}},"Port":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Bandaranaike International Airport"},"code":{"type":"string","example":"CMB"},"country":{"type":"string","example":"Sri Lanka"},"city":{"type":"string","example":"Colombo"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PortInput":{"type":"object","required":["name","code","country","city"],"properties":{"name":{"type":"string"},"code":{"type":"string","maxLength":3},"country":{"type":"string"},"city":{"type":"string"}}},"Flight":{"type":"object","properties":{"id":{"type":"integer","example":1},"flight_number":{"type":"string","example":"UL101"},"origin":{"type":"string","example":"CMB"},"destination":{"type":"string","example":"LHR"},"departure_at":{"type":"string","format":"date-time"},"arrival_at":{"type":"string","format":"date-time"},"fare":{"type":"number","format":"float","example":450.0},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"FlightInput":{"type":"object","required":["flight_number","origin","destination","departure_at","arrival_at","fare"],"properties":{"flight_number":{"type":"string"},"origin":{"type":"string"},"destination":{"type":"string"},"departure_at":{"type":"string","format":"date-time"},"arrival_at":{"type":"string","format":"date-time"},"fare":{"type":"number","format":"float"}}},"Booking":{"type":"object","properties":{"id":{"type":"integer","example":42},"passenger_name":{"type":"string","example":"Shakeel Ahmed"},"flight_id":{"type":"integer","example":12},"seat_number":{"type":"string","example":"14A"},"status":{"type":"string","enum":["confirmed","cancelled","pending"],"example":"confirmed"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"BookingInput":{"type":"object","required":["passenger_name","flight_id","seat_number"],"properties":{"passenger_name":{"type":"string"},"flight_id":{"type":"integer"},"seat_number":{"type":"string"},"status":{"type":"string","enum":["confirmed","cancelled","pending"],"default":"pending"}}},"PaymentInput":{"type":"object","required":["booking_id","amount","currency","stripe_token"],"properties":{"booking_id":{"type":"integer"},"amount":{"type":"number","format":"float"},"currency":{"type":"string","example":"USD"},"stripe_token":{"type":"string","example":"tok_visa"}}},"PaymentRecord":{"type":"object","properties":{"payment_id":{"type":"string","example":"PAY-1717600000000-123"},"booking_id":{"type":"integer","example":42},"amount":{"type":"number","example":450.0},"currency":{"type":"string","example":"USD"},"status":{"type":"string","example":"SUCCESS"},"paid_at":{"type":"string","format":"date-time"}}},"BaggageInput":{"type":"object","required":["booking_id","baggage_tag","weight_kg"],"properties":{"booking_id":{"type":"integer"},"baggage_tag":{"type":"string"},"weight_kg":{"type":"number","format":"float"}}},"BaggageRecord":{"type":"object","properties":{"baggage_id":{"type":"string","example":"BAG-1717600000000-456"},"booking_id":{"type":"integer","example":42},"baggage_tag":{"type":"string","example":"TAG-2026-001"},"weight_kg":{"type":"number","example":23.5},"status":{"type":"string","example":"CHECKED_IN"},"checked_in_at":{"type":"string","format":"date-time"}}}}}}