openapi: 3.0.1
info:
  title: Airport Manager
  description: |
    Microservice Application for Airport Manager
  contact:
    name: Martin Slovik
    email: 540485@mail.muni.cz
    # insert your information as well
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  version: "1.1"
servers:
  - url: "{scheme}://{server}:{port}"
    description: my server
    variables:
      scheme:
        default: http
        enum:
          - http
          - https
      server:
        default: localhost
      port:
        default: "8080"
tags:
  - name: Core
    description: Microservice for core.
paths:
  /api/stewards:
    get:
      tags:
        - Steward
      summary: Get all stewards.
      description: |
        Returns an array of objects representing stewards.
      operationId: getAllStewards
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/StewardDto'
    post:
      tags:
        - Steward
      summary: Create a new steward.
      description: |
        Creates a new steward and returns it as a response.
      operationId: createSteward
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewStewardDtoRequest'
        required: true
      responses:
        "201":
          $ref: '#/components/responses/SingleStewardDtoResponse'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/stewards/{id}:
    get:
      tags:
        - Steward
      summary: Get steward by id
      description: Returns a steward by id.
      operationId: getSteward
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StewardDto'
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    delete:
      tags:
        - Steward
      summary: Delete steward by id.
      operationId: deleteSteward
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "204":
          description: Deleted
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    put:
      tags:
        - Steward
      summary: Update steward by id.
      operationId: updateSteward
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      description: |
        Updates a steward by id and returns it as a response.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewStewardDtoRequest'
        required: true
      responses:
        "200":
          $ref: '#/components/responses/SingleStewardDtoResponse'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/stewards/{stewardId}/flights/{flightId}:
    post:
      tags:
        - Steward
      summary: Assign steward to a flight.
      operationId: createStewardFlights
      parameters:
        - name: stewardId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: flightId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "201":
          $ref: '#/components/responses/SingleStewardDtoResponse'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    put:
      tags:
        - Steward
      summary: Update assignment of steward to a flight.
      operationId: updateStewardFlights
      parameters:
        - name: stewardId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: flightId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          $ref: '#/components/responses/SingleStewardDtoResponse'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    delete:
      tags:
        - Steward
      summary: Delete assignment of steward to a flight.
      operationId: deleteStewardFlights
      parameters:
        - name: stewardId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: flightId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "204":
          description: Deleted
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/stewards/paged:
    get:
      tags:
        - Steward
      summary: Paged stewards
      description: |
        Returns a page of stewards.
        The parameter `page` specifies zero-based index of the requested page,
        and the parameter `size` specifies the size of the page.
      operationId: getStewardsPaged
      parameters:
        - name: page
          in: query
          description: Zero-based page index (0..N)
          required: false
          schema:
            minimum: 0
            type: integer
            default: 0
        - name: size
          in: query
          description: The size of the page to be returned
          required: false
          schema:
            minimum: 1
            type: integer
            default: 20
        - name: sort
          in: query
          description: "Sorting criteria in the format: property,(asc|desc). Default\
          \ sort order is ascending. Multiple sort criteria are supported."
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PageStewardDto'
  /api/flights:
    get:
      tags:
        - Flight
      summary: Get all flights.
      description: |
        Returns an array of objects representing flights.
      operationId: getAllFlights
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/FlightDto'
    post:
      tags:
        - Flight
      summary: Create a new flight.
      description: |
        Creates a new flight and returns it as a response.
      operationId: createFlight
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewFlightDtoRequest'
        required: true
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlightDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/flights/{id}:
    get:
      tags:
        - Flight
      summary: Get flight by id.
      description: |
        Returns an object representing a flight.
      operationId: getFlightById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlightDto'
    delete:
      tags:
        - Flight
      summary: Delete flight by id.
      operationId: deleteFlight
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "204":
          description: Deleted
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    put:
      tags:
        - Flight
      summary: Update flight by id.
      operationId: updateFlight
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      description: Updates a flight by id and returns it as a response.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewFlightDtoRequest'
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlightDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/airplaneTypes:
    get:
      tags:
        - AirplaneType
      summary: Get all airplane types.
      description: |
        Returns an array of objects representing airplane types.
      operationId: getAllAirplaneTypes
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AirplaneTypeDto'
    post:
      tags:
        - AirplaneType
      summary: Create a new airplane type.
      description: Creates a new airplane type and returns it as a response.
      operationId: createAirplaneType
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewAirplaneTypeDtoRequest'
        required: true
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirplaneTypeDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/airplaneTypes/{id}:
    get:
      tags:
        - AirplaneType
      summary: Get airplane type by id.
      description: Returns an object representing an airplane type.
      operationId: getAirplaneTypeById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirplaneTypeDto'
    delete:
      tags:
        - AirplaneType
      summary: Delete airplane type by id.
      operationId: deleteAirplaneType
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "204":
          description: Deleted
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    put:
      tags:
        - AirplaneType
      summary: Update airplane type by id.
      operationId: updateAirplaneType
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      description: Updates a airplane type by id and returns it as a response.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AirplaneTypeDto'
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirplaneTypeDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/airplanes:
    get:
      tags:
        - Airplane
      summary: Get all airplanes.
      description: Returns an array of objects representing airplanes.
      operationId: getAllAirplanes
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AirplaneDto'
    post:
      tags:
        - Airplane
      summary: Create a new airplane.
      description: Creates a new airplane and returns it as a response.
      operationId: createAirplane
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewAirplaneDtoRequest'
        required: true
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirplaneDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/airplanes/{id}:
    get:
      tags:
        - Airplane
      summary: Get airplane by id.
      description: Returns an object representing an airplane.
      operationId: getAirplaneById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirplaneDto'
    delete:
      tags:
        - Airplane
      summary: Delete airplane by id.
      operationId: deleteAirplane
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "204":
          description: Deleted
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    put:
      tags:
        - Airplane
      summary: Update airplane by id.
      operationId: updateAirplane
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      description: Updates a airplane by id and returns it as a response.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AirplaneDto'
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirplaneDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/airplanes/{airplaneId}/airplaneTypes/{airplaneTypeId}:
    post:
      tags:
        - Airplane
      summary: Assign airplane type to a airplane.
      operationId: assignAirplaneType
      parameters:
        - name: airplaneId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: airplaneTypeId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "201":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirplaneDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    put:
      tags:
        - Airplane
      summary: Update assignment of airplane type to an airplane.
      operationId: updateAirplaneTypeAssignment
      parameters:
        - name: airplaneId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: airplaneTypeId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirplaneDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    delete:
      tags:
        - Airplane
      summary: Delete assignment of airplane type to an airplane.
      operationId: deleteAirplaneTypeAssignment
      parameters:
        - name: airplaneId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: airplaneTypeId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "204":
          description: Deleted
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/countries:
    get:
      tags:
        - Country
      summary: Get all countries.
      description: Returns an array of objects representing countries.
      operationId: getAllCountries
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CountryDto'
    post:
      tags:
        - Country
      summary: Create a new country.
      description: Creates a new country and returns it as a response.
      operationId: createCountry
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewCountryDtoRequest'
        required: true
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CountryDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/countries/{id}:
    get:
      tags:
        - Country
      summary: Get country by id.
      description: Returns an object representing a country.
      operationId: getCountryById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CountryDto'
    delete:
      tags:
        - Country
      summary: Delete country by id.
      operationId: deleteCountry
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "204":
          description: Deleted
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    put:
      tags:
        - Country
      summary: Update country by id.
      operationId: updateCountry
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      description: Updates a country by id and returns it as a response.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CountryDto'
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CountryDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/cities:
    get:
      tags:
        - Country
      summary: Get all cities.
      description: Returns an array of objects representing cities.
      operationId: getAllCities
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CityDto'
    post:
      tags:
        - City
      summary: Create a new city.
      description: Creates a new city and returns it as a response.
      operationId: createCity
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewCityDtoRequest'
        required: true
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CityDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/cities/{id}:
    get:
      tags:
        - City
      summary: Get city by id.
      description: Returns an object representing a city.
      operationId: getCityById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CityDto'
    delete:
      tags:
        - City
      summary: Delete city by id.
      operationId: deleteCity
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "204":
          description: Deleted
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    put:
      tags:
        - City
      summary: Update city by id.
      operationId: updateCity
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      description: Updates a city by id and returns it as a response.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CityDto'
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CityDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/cities/{cityId}/countries/{countryId}:
    post:
      tags:
        - City
      summary: Assign country to a city.
      operationId: assignCountry
      parameters:
        - name: cityId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: countryId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "201":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CityDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    put:
      tags:
        - City
      summary: Update assignment of country to a city.
      operationId: updateCountryAssignment
      parameters:
        - name: cityId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: countryId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CityDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    delete:
      tags:
        - City
      summary: Delete assignment of country to a city.
      operationId: deleteCountryAssignment
      parameters:
        - name: cityId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: countryId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "204":
          description: Deleted
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/cities/{cityId}/airports/{airportId}:
    post:
      tags:
        - City
      summary: Assign airport to a city.
      operationId: assignAirport
      parameters:
        - name: cityId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: airportId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "201":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CityDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    put:
      tags:
        - City
      summary: Update assignment of airport to a city.
      operationId: updateAirportAssignment
      parameters:
        - name: cityId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: airportId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CityDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    delete:
      tags:
        - City
      summary: Delete assignment of airport to a city.
      operationId: deleteAirportAssignment
      parameters:
        - name: cityId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: airportId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "204":
          description: Deleted
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/airports:
    get:
      tags:
        - Airport
      summary: Get all airports.
      description: Returns an array of objects representing airports.
      operationId: getAllAirports
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AirportDto'
    post:
      tags:
        - Airport
      summary: Create a new airport.
      description: Creates a new airport and returns it as a response.
      operationId: createAirport
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewAirportDtoRequest'
        required: true
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirportDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/airports/{id}:
    get:
      tags:
        - Airport
      summary: Get airport by id.
      description: Returns an object representing an airport.
      operationId: getAirportById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirportDto'
    delete:
      tags:
        - Airport
      summary: Delete airport by id.
      operationId: deleteAirport
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "204":
          description: Deleted
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    put:
      tags:
        - Airport
      summary: Update city by id.
      operationId: updateAirport
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
      description: Updates a airport by id and returns it as a response.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AirportDto'
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirportDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/airports/{airportId}/departingFlights/{departingFlightId}:
    post:
      tags:
        - Airport
      summary: Assign departing flight to an airport.
      operationId: assignDepartingFlight
      parameters:
        - name: airportId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: departingFlightId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "201":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirportDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    put:
      tags:
        - Airport
      summary: Update assignment of departing flight to an airport.
      operationId: updateDepartingFlightAssignment
      parameters:
        - name: airportId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: departingFlightId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirportDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    delete:
      tags:
        - Airport
      summary: Delete assignment of departing flight to an airport.
      operationId: deleteDepartingFlightAssignment
      parameters:
        - name: airportId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: departingFlightId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "204":
          description: Deleted
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /api/airports/{airportId}/arrivingFlights/{arrivingFlightId}:
    post:
      tags:
        - Airport
      summary: Assign arriving flight to an airport.
      operationId: assignArrivingFlight
      parameters:
        - name: airportId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: arrivingFlightId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "201":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirportDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    put:
      tags:
        - Airport
      summary: Update assignment of arriving flight to an airport.
      operationId: updateArrivingFlightAssignment
      parameters:
        - name: airportId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: arrivingFlightId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AirportDto'
        "400":
          description: Input data not correct
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    delete:
      tags:
        - Airport
      summary: Delete assignment of arriving flight to an airport.
      operationId: deleteArrivingFlightAssignment
      parameters:
        - name: airportId
          in: path
          required: true
          schema:
            type: integer
            format: int64
        - name: arrivingFlightId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "204":
          description: Deleted
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
components:
  schemas:
    DomainEntityDto:
      title: Domain Entity
      description: Represents a Domain Entity
      type: object
      required:
        - id
      properties:
        id:
          type: integer
          description: unique id
          format: int64
          example: 1
      discriminator:
        propertyName: objectType
    ErrorMessage:
      allOf:
        - $ref: '#/components/schemas/DomainEntityDto'
      title: Error Message
      description: Response body for HTML statuses.
      type: object
      properties:
        timestamp:
          type: string
          description: time in ISO format
          format: date-time
          example: 2022-12-21T18:52:10.757Z
        status:
          type: integer
          description: HTTP status code
          format: int32
          example: 404
        error:
          type: string
          description: HTTP status text
          example: Not Found
        message:
          type: string
          description: reason for error
          example: entity not found
        path:
          type: string
          description: URL path
          example: /api/stewards/1
    StewardDto:
      allOf:
        - $ref: '#/components/schemas/DomainEntityDto'
      type: object
      title: Steward
      description: Represents a steward on a flight.
      required:
        - id
        - firstName
        - lastName
      properties:
        firstName:
          type: string
          description: first name of a steward
          example: John
        lastName:
          type: string
          description: last name of a steward
          example: Doe
        flights:
          type: array
          description: flights assigned to a steward
          items:
            $ref: '#/components/schemas/FlightDto'
    NewStewardDtoRequest:
      type: object
      title: New Steward Request
      description: Object for requesting a new Steward.
      required:
        - firstName
        - lastName
      properties:
        firstName:
          type: string
          description: first name of a steward
          example: John
        lastName:
          type: string
          description: last name of a steward
          example: Doe
    FlightDto:
      allOf:
        - $ref: '#/components/schemas/DomainEntityDto'
      type: object
      title: Flight
      description: Represents a flight.
      required:
        - id
        - departureTime
        - arrivalTime
        - stewards
        - airplane
        - departureAirport
        - arrivalAirport
      properties:
        departureTime:
          type: string
          description: time of flight departure
          format: date-time
          example: 2022-12-22T12:04:04.493908908+01:00
        arrivalTime:
          type: string
          description: time of flight arrival
          format: date-time
          example: 2022-12-22T12:04:04.493908908+01:00
        stewards:
          type: array
          description: stewards assigned to a flight
          items:
            $ref: '#/components/schemas/StewardDto'
        airplane:
          $ref: '#/components/schemas/AirplaneDto'
        departureAirport:
          $ref: '#/components/schemas/AirportDto'
        arrivalAirport:
          $ref: '#/components/schemas/AirportDto'
    NewFlightDtoRequest:
      type: object
      title: New Flight Request
      description: Object for requesting a new Flight.
      required:
        - departureTime
        - arrivalTime
      properties:
        departureTime:
          type: string
          description: time of flight departure
          format: date-time
          example: 2022-12-22T12:04:04.493908908+01:00
        arrivalTime:
          type: string
          description: time of flight arrival
          format: date-time
          example: 2022-12-22T12:04:04.493908908+01:00
    AirplaneTypeDto:
      allOf:
        - $ref: '#/components/schemas/DomainEntityDto'
      type: object
      title: Airplane Type
      description: Represents an Airplane Type.
      required:
        - id
        - name
      properties:
        name:
          type: string
          description: airplane type name
          example: Boeing 747
    NewAirplaneTypeDtoRequest:
      type: object
      title: New Airplane Type Request
      description: Object for requesting a new Airplane Type.
      required:
        - name
      properties:
        name:
          type: string
          description: airplane type name
          example: Boeing 747
    AirplaneDto:
      allOf:
        - $ref: '#/components/schemas/DomainEntityDto'
      type: object
      title: Airplane
      description: Represents an Airplane.
      required:
        - id
        - name
        - capacity
        - type
      properties:
        name:
          type: string
          description: airplane name
          example: Spitfire
        capacity:
          type: integer
          description: airplane seat capacity
          format: int32
          example: 150
        type:
          $ref: '#/components/schemas/AirplaneTypeDto'
    NewAirplaneDtoRequest:
      type: object
      title: New Airplane Request
      description: Object for requesting a new Airplane.
      required:
        - name
        - capacity
      properties:
        name:
          type: string
          description: airplane name
          example: Spitfire
        capacity:
          type: integer
          description: airplane seat capacity
          format: int32
          example: 150
    PageableObject:
      type: object
      title: Pageable Object
      properties:
        offset:
          type: integer
          format: int64
        sort:
          $ref: '#/components/schemas/SortObject'
        pageSize:
          type: integer
          format: int32
        pageNumber:
          type: integer
          format: int32
        paged:
          type: boolean
        unpaged:
          type: boolean
    SortObject:
      type: object
      title: Sort Object
      properties:
        empty:
          type: boolean
        sorted:
          type: boolean
        unsorted:
          type: boolean
    PageStewardDto:
      type: object
      title: Paged Stewards
      properties:
        totalPages:
          type: integer
          format: int32
        totalElements:
          type: integer
          format: int64
        first:
          type: boolean
        last:
          type: boolean
        size:
          type: integer
          format: int32
        content:
          type: array
          items:
            $ref: '#/components/schemas/StewardDto'
        number:
          type: integer
          format: int32
        sort:
          $ref: '#/components/schemas/SortObject'
        numberOfElements:
          type: integer
          format: int32
        pageable:
          $ref: '#/components/schemas/PageableObject'
        empty:
          type: boolean
    CountryDto:
      allOf:
        - $ref: '#/components/schemas/DomainEntityDto'
      type: object
      title: Country
      description: Represents a country.
      required:
        - id
        - name
      properties:
        name:
          type: string
          description: country name
          example: Canada
    NewCountryDtoRequest:
      type: object
      title: New Country Request
      description: Object for requesting a new Country.
      required:
        - name
      properties:
        name:
          type: string
          description: country name
          example: Canada
    CityDto:
      allOf:
        - $ref: '#/components/schemas/DomainEntityDto'
      type: object
      title: City
      description: Represents a City in a Country containing Airports.
      required:
        - id
        - name
      properties:
        name:
          type: string
          description: city name
          example: London
        country:
          $ref: '#/components/schemas/CountryDto'
        airports:
          type: array
          items:
            $ref: '#/components/schemas/AirportDto'
    NewCityDtoRequest:
      type: object
      title: New City Request
      description: Object for requesting a new City.
      required:
        - name
      properties:
        name:
          type: string
          description: city name
          example: London
    GPSLocationDto:
      type: object
      title: GPS Location
      description: Represents a GPS Location of latitude and longitude.
      required:
        - latitude
        - longitude
      properties:
        latitude:
          type: number
          format: double
          example: 41.40338
        longitude:
          type: number
          format: double
          example: 2.17403
    AirportDto:
      allOf:
        - $ref: '#/components/schemas/DomainEntityDto'
      type: object
      title: Airport
      description: Represents an Airport.
      required:
        - id
        - name
        - code
        - departingFlights
        - arrivingFlights
        - city
        - location
      properties:
        name:
          type: string
          description: airport name
          example: John F. Kennedy International Airport
        code:
          type: string
          description: airport code in IATA format
          example: JFK
        departingFlights:
          type: array
          items:
            $ref: '#/components/schemas/FlightDto'
        arrivingFlights:
          type: array
          items:
            $ref: '#/components/schemas/FlightDto'
        city:
          $ref: '#/components/schemas/CityDto'
        location:
          $ref: '#/components/schemas/GPSLocationDto'
    NewAirportDtoRequest:
      type: object
      title: New Airport Type Request
      description: Object for requesting a new Airport.
      required:
        - name
        - code
      properties:
        name:
          type: string
          description: airport name
          example: John F. Kennedy International Airport
        code:
          type: string
          description: airport code in IATA format
          example: JFK
  responses:
    SingleStewardDtoResponse:
      description: Response containing a single Steward.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StewardDto'
      links:
        link_to_getSteward:
          operationId: getSteward
          parameters:
            id: $response.body#/id
          description: |
            The `id` value returned in the response can be used as
            the `id` parameter in `GET /stewards/{id}`.