syntax = "proto3";

package flight;
import "google/protobuf/timestamp.proto";

service FlightGrpcService {

  rpc GetById (GetByIdRequest) returns (FlightResponse);
  rpc GetAvailableSeats (GetAvailableSeatsRequest) returns (ListSeatsResponse);
  rpc ReserveSeat (ReserveSeatRequest) returns (SeatsResponse);
}

message GetByIdRequest {
  int64 Id = 1;
}

message FlightResponse {
  int64 Id = 1;
  string FlightNumber = 2;
  int64 AircraftId = 3;
  int64 DepartureAirportId = 4;
  google.protobuf.Timestamp DepartureDate = 5;
  google.protobuf.Timestamp ArriveDate = 6;
  int64 ArriveAirportId = 7;
  double DurationMinutes = 8;
  google.protobuf.Timestamp FlightDate = 9;
  FlightStatus Status = 10;
  double Price = 11;
  int64 FlightId = 12;
}

message GetAvailableSeatsRequest {
  int64 FlightId = 1;
}

message SeatsResponse {
  int64 Id = 1;
  string SeatNumber = 2;
  SeatType Type = 3;
  SeatClass Class = 4;
  int64 FlightId = 5;
}


message ReserveSeatRequest {
  int64 FlightId = 1;
  string SeatNumber = 2;
}

message ListSeatsResponse {
  repeated SeatsResponse items = 1;
}

    enum FlightStatus {
      FLIGHT_STATUS_UNKNOWN = 0;
      FLIGHT_STATUS_FLYING = 1;
      FLIGHT_STATUS_DELAY = 2;
      FLIGHT_STATUS_CANCELED = 3;
      FLIGHT_STATUS_COMPLETED = 4;
    }


    enum SeatType {
        SEAT_TYPE_UNKNOWN = 0;
        SEAT_TYPE_WINDOW = 1;
        SEAT_TYPE_MIDDLE = 2;
        SEAT_TYPE_AISLE = 3;
    }


    enum SeatClass {
        SEAT_CLASS_UNKNOWN = 0;
        SEAT_CLASS_FIRST_CLASS = 1;
        SEAT_CLASS_BUSINESS = 2;
        SEAT_CLASS_ECONOMY = 3;
    }
