<?xml version="1.0" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="equipment" type="equipment"/>

  <xs:element name="response" type="currentFlightTracksResponse"/>

  <xs:complexType name="currentFlightTracksResponse" final="extension restriction">
    <xs:all>
      <xs:element name="appendix" type="appendixWithWrapper" minOccurs="0"/>
      <xs:element name="error" type="apiResponseError" minOccurs="0"/>
      <xs:element name="flightPositions" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="flightPosition" type="FlightPosition" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="flightTrack" type="flightTrack" minOccurs="0"/>
      <xs:element name="flightTracks" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="flightTrack" type="flightTrack" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="request" type="interpretedRequest" minOccurs="0"/>
    </xs:all>
  </xs:complexType>

  <xs:complexType name="appendixWithWrapper" final="extension restriction">
    <xs:sequence>
      <xs:element name="airlines" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="airline" type="airline" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="airports" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="airport" type="airport" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="equipments" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element ref="equipment" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="airline" final="extension restriction">
    <xs:sequence>
      <xs:element name="fs" type="xs:string" minOccurs="0"/>
      <xs:element name="iata" type="xs:string" minOccurs="0"/>
      <xs:element name="icao" type="xs:string" minOccurs="0"/>
      <xs:element name="name" type="xs:string" minOccurs="0"/>
      <xs:element name="phoneNumber" type="xs:string" minOccurs="0"/>
      <xs:element name="active" type="xs:boolean"/>
      <xs:element name="dateFrom" type="xs:string" minOccurs="0"/>
      <xs:element name="dateTo" type="xs:string" minOccurs="0"/>
      <xs:element name="category" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="airport" final="extension restriction">
    <xs:sequence>
      <xs:element name="fs" type="xs:string" minOccurs="0"/>
      <xs:element name="iata" type="xs:string" minOccurs="0"/>
      <xs:element name="icao" type="xs:string" minOccurs="0"/>
      <xs:element name="faa" type="xs:string" minOccurs="0"/>
      <xs:element name="name" type="xs:string" minOccurs="0"/>
      <xs:element name="street1" type="xs:string" minOccurs="0"/>
      <xs:element name="street2" type="xs:string" minOccurs="0"/>
      <xs:element name="city" type="xs:string" minOccurs="0"/>
      <xs:element name="cityCode" type="xs:string" minOccurs="0"/>
      <xs:element name="district" type="xs:string" minOccurs="0"/>
      <xs:element name="stateCode" type="xs:string" minOccurs="0"/>
      <xs:element name="postalCode" type="xs:string" minOccurs="0"/>
      <xs:element name="countryCode" type="xs:string" minOccurs="0"/>
      <xs:element name="countryName" type="xs:string" minOccurs="0"/>
      <xs:element name="regionName" type="xs:string" minOccurs="0"/>
      <xs:element name="regionIata" type="xs:string" minOccurs="0"/>
      <xs:element name="timeZoneRegionName" type="xs:string" minOccurs="0"/>
      <xs:element name="weatherZone" type="xs:string" minOccurs="0"/>
      <xs:element name="localTime" type="xs:string" minOccurs="0"/>
      <xs:element name="utcOffsetHours" type="xs:double"/>
      <xs:element name="latitude" type="xs:double"/>
      <xs:element name="longitude" type="xs:double"/>
      <xs:element name="elevationFeet" type="xs:int" minOccurs="0"/>
      <xs:element name="classification" type="xs:int"/>
      <xs:element name="active" type="xs:boolean"/>
      <xs:element name="dateFrom" type="xs:string" minOccurs="0"/>
      <xs:element name="dateTo" type="xs:string" minOccurs="0"/>
      <xs:element name="delayIndexUrl" type="xs:string" minOccurs="0"/>
      <xs:element name="weatherUrl" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="equipment" final="extension restriction">
    <xs:sequence>
      <xs:element name="iata" type="xs:string" minOccurs="0"/>
      <xs:element name="name" type="xs:string" minOccurs="0"/>
      <xs:element name="turboProp" type="xs:boolean" minOccurs="0"/>
      <xs:element name="jet" type="xs:boolean" minOccurs="0"/>
      <xs:element name="widebody" type="xs:boolean" minOccurs="0"/>
      <xs:element name="regional" type="xs:boolean" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="apiResponseError">
    <xs:all>
      <xs:element name="httpStatusCode" type="xs:int"/>
      <xs:element name="errorId" type="xs:string" minOccurs="0"/>
      <xs:element name="errorMessage" type="xs:string" minOccurs="0"/>
      <xs:element name="errorCode" type="xs:string" minOccurs="0"/>
    </xs:all>
  </xs:complexType>

  <xs:complexType name="FlightPosition">
    <xs:sequence>
      <xs:element name="flightId" type="xs:long" minOccurs="0"/>
      <xs:element name="callsign" type="xs:string" minOccurs="0"/>
      <xs:element name="tailNumber" type="xs:string" minOccurs="0"/>
      <xs:element name="heading" type="xs:double" minOccurs="0"/>
      <xs:element name="source" type="xs:string" minOccurs="0"/>
      <xs:element name="positions" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="position" final="extension restriction">
    <xs:sequence>
      <xs:element name="lon" type="xs:double" minOccurs="0"/>
      <xs:element name="lat" type="xs:double" minOccurs="0"/>
      <xs:element name="speedMph" type="xs:int" minOccurs="0"/>
      <xs:element name="altitudeFt" type="xs:int" minOccurs="0"/>
      <xs:element name="source" type="xs:string" minOccurs="0"/>
      <xs:element name="date" type="xs:string" minOccurs="0"/>
      <xs:element name="course" type="xs:int" minOccurs="0"/>
      <xs:element name="vrateMps" type="xs:int" minOccurs="0"/>
      <xs:element name="phase" type="xs:string" minOccurs="0"/>
      <xs:element name="lastObserved" type="xs:string" minOccurs="0"/>
      <xs:element name="stationID" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="flightTrack">
    <xs:sequence>
      <xs:element name="flightId" type="xs:long" minOccurs="0"/>
      <xs:element name="carrier" type="airline" minOccurs="0"/>
      <xs:element name="carrierFsCode" type="xs:string" minOccurs="0"/>
      <xs:element name="flightNumber" type="xs:string" minOccurs="0"/>
      <xs:element name="tailNumber" type="xs:string" minOccurs="0"/>
      <xs:element name="callsign" type="xs:string" minOccurs="0"/>
      <xs:element name="departureAirport" type="airport" minOccurs="0"/>
      <xs:element name="departureAirportFsCode" type="xs:string" minOccurs="0"/>
      <xs:element name="arrivalAirport" type="airport" minOccurs="0"/>
      <xs:element name="arrivalAirportFsCode" type="xs:string" minOccurs="0"/>
      <xs:element name="departureDate" type="dateUtcAndLocal" minOccurs="0"/>
      <xs:element name="equipment" type="xs:string" minOccurs="0"/>
      <xs:element name="delayMinutes" type="xs:int" minOccurs="0"/>
      <xs:element name="bearing" type="xs:double" minOccurs="0"/>
      <xs:element name="heading" type="xs:double" minOccurs="0"/>
      <xs:element name="positions" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="position" type="position" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="waypoints" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="waypoint" type="waypoint" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="legacyRoute" type="xs:string" minOccurs="0"/>
      <xs:element name="irregularOperations" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="irregularOperation" type="irregularOperation" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="arrivalDate" type="dateUtcAndLocal" minOccurs="0"/>
      <xs:element name="status" type="xs:string" minOccurs="0"/>
      <xs:element name="fleetAircraftId" type="xs:long" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="dateUtcAndLocal" final="extension restriction">
    <xs:sequence>
      <xs:element name="dateLocal" type="xs:string" minOccurs="0"/>
      <xs:element name="dateUtc" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="waypoint" final="extension restriction">
    <xs:all>
      <xs:element name="lon" type="xs:double" minOccurs="0"/>
      <xs:element name="lat" type="xs:double" minOccurs="0"/>
    </xs:all>
  </xs:complexType>

  <xs:complexType name="irregularOperation" final="extension restriction">
    <xs:sequence>
      <xs:element name="type" type="xs:string" minOccurs="0"/>
      <xs:element name="newArrivalAirportFsCode" type="xs:string" minOccurs="0"/>
      <xs:element name="relatedFlightId" type="xs:long" minOccurs="0"/>
      <xs:element name="dateUtc" type="xs:string" minOccurs="0"/>
      <xs:element name="message" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="interpretedRequest">
    <xs:all>
      <xs:element name="flightId" type="inputParameter" minOccurs="0"/>
      <xs:element name="tailNumber" type="inputParameter" minOccurs="0"/>
      <xs:element name="airline" type="inputParameter" minOccurs="0"/>
      <xs:element name="carrier" type="inputParameter" minOccurs="0"/>
      <xs:element name="hourOfDay" type="inputParameter" minOccurs="0"/>
      <xs:element name="flight" type="inputParameter" minOccurs="0"/>
      <xs:element name="utc" type="inputParameter" minOccurs="0"/>
      <xs:element name="includeFlightPlan" type="inputParameter" minOccurs="0"/>
      <xs:element name="codeType" type="inputParameter" minOccurs="0"/>
      <xs:element name="numHours" type="inputParameter" minOccurs="0"/>
      <xs:element name="maxFlights" type="inputParameter" minOccurs="0"/>
      <xs:element name="maxPositions" type="inputParameter" minOccurs="0"/>
      <xs:element name="maxPositionAgeMinutes" type="inputParameter" minOccurs="0"/>
      <xs:element name="latitude" type="inputParameter" minOccurs="0"/>
      <xs:element name="longitude" type="inputParameter" minOccurs="0"/>
      <xs:element name="radiusMiles" type="inputParameter" minOccurs="0"/>
      <xs:element name="topLatitude" type="inputParameter" minOccurs="0"/>
      <xs:element name="leftLongitude" type="inputParameter" minOccurs="0"/>
      <xs:element name="bottomLatitude" type="inputParameter" minOccurs="0"/>
      <xs:element name="rightLongitude" type="inputParameter" minOccurs="0"/>
      <xs:element name="url" type="xs:string" minOccurs="0"/>
      <xs:element name="airport" type="inputParameter" minOccurs="0"/>
      <xs:element name="extendedOptions" type="inputParameter" minOccurs="0"/>
      <xs:element name="date" type="interpretedDateFields" minOccurs="0"/>
    </xs:all>
  </xs:complexType>

  <xs:complexType name="inputParameter">
    <xs:all>
      <xs:element name="airport" type="airport" minOccurs="0"/>
      <xs:element name="airline" type="airline" minOccurs="0"/>
      <xs:element ref="equipment" minOccurs="0"/>
      <xs:element name="fsCode" type="xs:string" minOccurs="0"/>
      <xs:element name="interpreted" type="xs:string" minOccurs="0"/>
      <xs:element name="requestedCode" type="xs:string" minOccurs="0"/>
      <xs:element name="requested" type="xs:string" minOccurs="0"/>
    </xs:all>
  </xs:complexType>

  <xs:complexType name="interpretedDateFields">
    <xs:all>
      <xs:element name="year" type="xs:string" minOccurs="0"/>
      <xs:element name="month" type="xs:string" minOccurs="0"/>
      <xs:element name="day" type="xs:string" minOccurs="0"/>
      <xs:element name="hour" type="xs:string" minOccurs="0"/>
      <xs:element name="minute" type="xs:string" minOccurs="0"/>
      <xs:element name="interpreted" type="xs:string" minOccurs="0"/>
    </xs:all>
  </xs:complexType>
</xs:schema>

