syntax = "proto3";

package worldmonitor.aviation.v1;

import "buf/validate/validate.proto";
import "sebuf/http/annotations.proto";
import "worldmonitor/aviation/v1/flight_instance.proto";

// FlightDirection specifies whether to retrieve departures, arrivals, or both.
enum FlightDirection {
  // Unspecified — defaults to both directions.
  FLIGHT_DIRECTION_UNSPECIFIED = 0;
  // Departing flights only.
  FLIGHT_DIRECTION_DEPARTURE = 1;
  // Arriving flights only.
  FLIGHT_DIRECTION_ARRIVAL = 2;
  // Both departures and arrivals.
  FLIGHT_DIRECTION_BOTH = 3;
}

// ListAirportFlightsRequest specifies parameters for retrieving recent flights at an airport.
message ListAirportFlightsRequest {
  // IATA airport code (e.g., "IST").
  string airport = 1 [
    (sebuf.http.query) = { name: "airport" },
    (buf.validate.field).required = true,
    (buf.validate.field).string.min_len = 3,
    (buf.validate.field).string.max_len = 4
  ];
  // Direction filter.
  FlightDirection direction = 2 [(sebuf.http.query) = { name: "direction" }];
  // Maximum number of flights to return (1-100).
  int32 limit = 3 [
    (sebuf.http.query) = { name: "limit" },
    (buf.validate.field).int32.gte = 1,
    (buf.validate.field).int32.lte = 100
  ];
}

// ListAirportFlightsResponse contains recent flights at an airport.
message ListAirportFlightsResponse {
  // Flight instances matching the query.
  repeated FlightInstance flights = 1;
  // Total number of flights available from the provider.
  int32 total_available = 2;
  // Data source identifier.
  string source = 3;
  // Last update time as Unix epoch milliseconds.
  int64 updated_at = 4 [(sebuf.http.int64_encoding) = INT64_ENCODING_NUMBER];
}
