# https://github.com/Huachao/vscode-restclient
@api-gateway=https://localhost:5000
@identity-api=https://localhost:5005
@flight-api=https://localhost:5003
@passenger-api=https://localhost:5012
@booking-api=https://localhost:5010
@contentType = application/json
@flightid = 1
@passengerId = 1

################################# Identity API #################################

###
# @name ApiRoot_Identity
GET {{identity-api}}
###


###
# @name Authenticate
POST {{api-gateway}}/connect/token
Content-Type: application/x-www-form-urlencoded

grant_type=password
&client_id=client
&client_secret=secret
&username=samh
&password=Admin@123456
&scope=flight-api
###



###
# @name Register_New_User
POST {{api-gateway}}/identity/register-user
accept: application/json
Content-Type: application/json
authorization: bearer {{Authenticate.response.body.access_token}}

{
  "firstName": "John",
  "lastName": "Do",
  "username": "admin",
  "passportNumber": "1290000000",
  "email": "admin@admin.com",
  "password": "Admin6@12345",
  "confirmPassword": "Admin6@12345"
}
###

################################# Flight API #################################

###
# @name ApiRoot_Flight
GET {{flight-api}}
###

###
# @name Create_Seat
Post {{api-gateway}}/api/v1/flight/seat
accept: application/json
Content-Type: application/json
authorization: bearer {{Authenticate.response.body.access_token}}

{
  "seatNumber": "12H9",
  "type": 1,
  "class": 1,
  "flightId": 1
}
###


###
# @name Reserve_Seat
Post {{api-gateway}}/api/v1/flight/reserve-seat
accept: application/json
Content-Type: application/json
authorization: bearer {{Authenticate.response.body.access_token}}

{
  "flightId": 1,
  "seatNumber": "12H9"
}
###


###
# @name Get_Available_Seats
GET {{api-gateway}}/api/v1/flight/get-available-seats/{{flightid}}
accept: application/json
Content-Type: application/json
authorization: bearer {{Authenticate.response.body.access_token}}
###


###
# @name Get_Flight_By_Id
GET {{api-gateway}}/api/v1/flight/{{flightid}}
accept: application/json
Content-Type: application/json
authorization: bearer {{Authenticate.response.body.access_token}}
###


###
# @name Get_Available_Flights
GET {{api-gateway}}/api/v1/flight/get-available-flights
accept: application/json
Content-Type: application/json
authorization: bearer {{Authenticate.response.body.access_token}}
###


###
# @name Create_Flights
POST {{api-gateway}}/api/v1/flight
accept: application/json
Content-Type: application/json
authorization: bearer {{Authenticate.response.body.access_token}}

{
  "flightNumber": "12BB44",
  "aircraftId": 1,
  "departureAirportId": 1,
  "departureDate": "2022-03-01T14:55:41.255Z",
  "arriveDate": "2022-03-01T14:55:41.255Z",
  "arriveAirportId": 2,
  "durationMinutes": 120,
  "flightDate": "2022-03-01T14:55:41.255Z",
  "status": 1,
  "price": 8000
}
###


###
# @name Update_Flights
PUT  {{api-gateway}}/api/v1/flight
accept: application/json
Content-Type: application/json
authorization: bearer {{Authenticate.response.body.access_token}}

{
  "id": 1,
  "flightNumber": "BD467",
  "aircraftId": 1,
  "departureAirportId": 1,
  "departureDate": "2022-04-23T12:17:45.140Z",
  "arriveDate": "2022-04-23T12:17:45.140Z",
  "arriveAirportId": 2,
  "durationMinutes": 120,
  "flightDate": "2022-04-23T12:17:45.140Z",
  "status": 4,
  "isDeleted": false,
  "price": 99000
}
###


###
# @name Delete_Flights
DELETE   {{api-gateway}}/api/v1/flight
accept: application/json
Content-Type: application/json
authorization: bearer {{Authenticate.response.body.access_token}}

{
  "id": 1
}
###


###
# @name Create_Airport
POST {{api-gateway}}/api/v1/flight/airport
accept: application/json
Content-Type: application/json
authorization: bearer {{Authenticate.response.body.access_token}}

{
  "name": "mehrabad",
  "address": "tehran",
  "code": "12YD"
}
###



###
# @name Create_Aircraft
POST {{api-gateway}}/api/v1/flight/aircraft
accept: application/json
Content-Type: application/json
authorization: bearer {{Authenticate.response.body.access_token}}

{
  "name": "airbus2",
  "model": "322",
  "manufacturingYear": 2012
}
###


################################# Passenger API #################################

###
# @name ApiRoot_Passenger
GET {{passenger-api}}
###


###
# @name Complete_Registration_Passenger
POST {{api-gateway}}/api/v1/passenger/complete-registration
accept: application/json
Content-Type: application/json
authorization: bearer {{Authenticate.response.body.access_token}}

{
  "passportNumber": "123456789",
  "passengerType": 1,
  "age": 30
}
###


###
# @name Get_Passenger_By_Id
GET  {{api-gateway}}/api/v1/passenger/{{passengerId}}
accept: application/json
Content-Type: application/json
authorization: bearer {{Authenticate.response.body.access_token}}
###


################################# Booking API #################################

###
# @name ApiRoot_Booking
GET {{booking-api}}
###


###
# @name Create_Booking
POST {{api-gateway}}/api/v1/booking
accept: application/json
Content-Type: application/json
authorization: bearer {{Authenticate.response.body.access_token}}

{
  "passengerId": 4779536520052736,
  "flightId": 1,
  "description": "I want to fly to iran"
}
###
