# Availability

## Availability

The Availability model provides information about the availability of the Location for aircraft movements, Aerodrome Rescue and Fire Fighting service, Aerodrome Air Traffic Services and Customs and Immigration facilities.

In the aviowiki API the following naming is used to identify these separate services:

* `movement` for the availability of the location for take-off and landing without any further guarantee of service
* `arff` for Aerodrome Rescue and Fire Fighting services
* `atc` for Air Traffic Services
* `ciq` for Customs, Immigration and Quarantine facilities

### Example <a href="#example" id="example"></a>

A query for the availability of a Location will return the following JSON data:

```
{
  "openingIndicator": "SEE_TIMES",
  "arff": [
    {
      "validFrom": "2021-05-17T00:00:00",
      "validTo": "2021-05-17T23:59:59.999999999",
      "status": "FULL",
      "info": {
        "icaoCatAirplane": "VIII",
        "faaCatAirplane": null,
        "faa139Certified": null,
        "catHelicopters": null,
        "waterQuantity": null,
        "complementaryQuantity": null,
        "arffVehicles": null,
        "dischargeCapacity": null,
        "extensionAvailable": null,
        "extensionNotice": null,
        "extensionUpToIcao": null,
        "firestationRemote": null,
        "firestationNotes": null
      }
    }
  ],
  "atc": [
    {
      "validFrom": "2021-05-17T00:00:00",
      "validTo": "2021-05-17T23:59:59.999999999",
      "status": "FULL",
      "info": {
        "enRtfAvailable": true,
        "afisOnly": false
      }
    }
  ],
  "ciq": [
    {
      "validFrom": "2021-05-17T00:00:00",
      "validTo": "2021-05-17T23:59:59.999999999",
      "status": "FULL"
    }
  ],
  "movement": [
    {
      "validFrom": "2021-05-17T00:00:00",
      "validTo": "2021-05-17T06:00:59.999999999",
      "status": "CLOSED"
    },
    {
      "validFrom": "2021-05-17T06:01:00",
      "validTo": "2021-05-17T23:30:59.999999999",
      "status": "FULL"
    },
    {
      "validFrom": "2021-05-17T23:31:00",
      "validTo": "2021-05-17T23:59:59.999999999",
      "status": "LIMITED",
      "notes": null,
      "openFor": [
        {
          "flightTypes": [
            {
              "rules": [],
              "filing": [],
              "airframe": [],
              "status": [
                "HUMANITARIAN",
                "FIREFIGHTING",
                "STATE",
                "HOSPITAL",
                "MEDEVAC",
                "SAR"
              ],
              "purpose": [],
              "direction": null
            }
          ],
          "priorNoticeRequired": 0,
          "costsInvolved": false,
          "other": null
        },
        {
          "flightTypes": [],
          "priorNoticeRequired": 0,
          "costsInvolved": false,
          "other": "Available for emergency diversion"
        }
      ]
    }
  ]
}
```

Each of `movement`, `arff`, `atc`, and `ciq` have a `blocks` property which is a list of time-referenced blocks that contain information on the availability of the individual service.

### Time reference <a href="#time-reference" id="time-reference"></a>

The API allows selecting if times returned are with reference to UTC or to Local Time. By default, all times for the Availability Blocks are with reference to the Local Time of the airport being queried.

When Availability times are entered in the aviowiki database, not all times are absolute, as some availability models depend on sunrise and sunset times. Whenever Availability Blocks are returned via the API, all such cases are resolved and times are always provided in an exact form, taking into account sunrise and sunset times where applicable.

### Availability `blocks` <a href="#availability-blocks" id="availability-blocks"></a>

Different services require different properties to express their availability, however, all Availability Blocks have these properties in common:

* `validFrom` is an ISO formatted date-time string that indicates when the block starts
* `validTo` is an ISO formatted date-time string that indicates when the block ends
* `status` is an enumeration that describes the current status of the facility. This can be&#x20;
  * `FULL` to indicate that the facility is fully available as described by the object,
  * `LIMITED` to indicate that the facility is available under certain conditions that cannot be described by the model, or
  * `CLOSED` to indicate that the facility is not available.

### `movement` Availability <a href="#movement-availability" id="movement-availability"></a>

Movement Availability indicates the availability for an aircraft to physically land or take-off at a location, with no guarantee of any other service being rendered.

In addition to the common Availability Block properties, Movement Availability Blocks with `status` of `LIMITED` also include the following properties:

* `openFor` a list of machine-readable conditions when Movement Availability can be considered equivalent to `FULL` .
* `notes` a string that describes any additional limitation to those listed in `openFor` and that can be `null` if none additional exists.

#### Modelling of `LIMITED` blocks in Movement Availability

The `openFor` property is a list of conditions that describe for who, and under what conditions an [Airport](https://docs.aviowiki.com/data-models/airport) could be available.

Each exception is described in the `flightType` object and has some additional conditions associated, to explain how access to the airport is possible.

Below a simplified structure of a Movement Availability block with `LIMITED` status:

```
{
  "movement": [
    {
      "validFrom": "2021-05-17T23:31:00",
      "validTo": "2021-05-17T23:59:59.999999999",
      "status": "LIMITED",
      "notes": null,
      "openFor": [
        {
          "flightTypes": [
            {
              "rules": [],
              "filing": [],
              "airframe": [],
              "status": [],
              "purpose": [],
              "direction": null
            }
          ],
          "priorNoticeRequired": 0,
          "costsInvolved": false,
          "other": null
        }
      ]
    }
  ]
}
```

The properties that define a flight object, under `flightTypes` are:

| Property    | Type           | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ----------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `rules`     | List           | <p>The flight rules under which the flight operates. Possible options are:</p><ul><li><code>VFR</code> for <a href="https://www.skybrary.aero/index.php/Visual_Flight_Rules_(VFR)">Visual Flight Rules</a>. ICAO <a href="https://www.skybrary.aero/index.php/Flight_Plan">Flightplan</a> <code>V</code>.</li><li><code>VFR\_TO\_IFR</code> for flights departing under Visual Flight Rules and transitioning to <a href="https://www.skybrary.aero/index.php/Instrument_Flight_Rules_(IFR)">Instrument Flight Rules</a>. ICAO <a href="https://www.skybrary.aero/index.php/Flight_Plan">Flightplan</a> <code>Z</code>.</li><li><code>IFR</code> for <a href="https://www.skybrary.aero/index.php/Instrument_Flight_Rules_(IFR)">Instrument Flight Rules</a>. ICAO <a href="https://www.skybrary.aero/index.php/Flight_Plan">Flightplan</a> <code>I</code>.</li><li><code>IFR\_TO\_VFR</code> for flights departing under <a href="https://www.skybrary.aero/index.php/Instrument_Flight_Rules_(IFR)">Instrument Flight Rules</a> and transitioning to <a href="https://www.skybrary.aero/index.php/Visual_Flight_Rules_(VFR)">Visual Flight Rules</a>. ICAO <a href="https://www.skybrary.aero/index.php/Flight_Plan">Flightplan</a> <code>Y</code>.</li></ul><p>An empty list indicates that there are no specific status requirements for flights. I.e. any flight, regardless of the rules it operates under, can operate</p> |
| `filing`    | List           | <p>The type of flight. Possible options are:</p><ul><li><code>SCHEDULED</code> for flights that operate according to a repetitive schedule. ICAO <a href="https://www.skybrary.aero/index.php/Flight_Plan">Flightplan</a> <code>S</code>.</li><li><code>NON\_SCHEDULED</code> for commercial flights that operate on an on-demand basis. ICAO <a href="https://www.skybrary.aero/index.php/Flight_Plan">Flightplan</a> <code>N</code>.</li><li><code>GENERAL\_AVIATION</code> for non-commercial flights that operate on an on-demand basis. ICAO <a href="https://www.skybrary.aero/index.php/Flight_Plan">Flightplan</a> <code>G</code>.</li><li><code>MILITARY</code>for flights operated by military organisations. ICAO <a href="https://www.skybrary.aero/index.php/Flight_Plan">Flightplan</a> <code>M</code>.</li><li><code>OTHER</code> for any flight that does not fall under the above categories. ICAO <a href="https://www.skybrary.aero/index.php/Flight_Plan">Flightplan</a> <code>X</code>.</li></ul><p>An empty list means that there are not specific requirements for this field. I.e. any flight, regardless of the type of flightplan, can operate</p>                                                                                                                                                                                                                                                      |
| `airframe`  | List           | <p>The category of aircraft being used. Possible options are:</p><ul><li><code>AEROPLANE</code> for all heavier than the air, fixed-wing aircraft.</li><li><code>VTOL</code> for all heavier than the air, rotary wing aircraft.</li></ul><p>An empty list indicates that there are no specific status requirements for flights. I.e. any flight, regardless of airframe type, can operate</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `status`    | List           | <p>Any special status as defined in ICAO Doc 4444, and mentioned in the <a href="https://www.skybrary.aero/index.php/Flight_Plan">Flightplan</a> Field 18 under <code>STS/</code>. Possible options  are:</p><ul><li><code>HUMANITARIAN</code> for a flight operating on a humanitarian mission.</li><li><code>FIREFIGHTING</code> for a flight operating on a firefighting mission.</li><li><code>STATE</code> for a flight engaged in military, customs or police services.</li><li><code>HEAD\_OF\_STATE</code> for a flight that carries a personality regarded to as the Head of a State.</li><li><code>HOSPITAL</code> for a medical flight declared by medical authorities.</li><li><code>MEDEVAC</code> for a life critical medical emergency evacuation.</li><li><code>SAR</code> for a flight engaged in a Search And Rescue mission.</li></ul><p>An empty list indicates that there are no specific status requirements for flights. I.e. any flight, regardless of its status, can operate</p>                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `purpose`   | List           | <p>The purpose for which the flight is operated. Possible options are:</p><ul><li><code>TRAINING</code> for any training flight.</li><li><code>CARGO</code> for flights that transport goods.</li><li><code>AIRLINE</code> for scheduled or unscheduled flights that transport passengers and are typically available for sale on a per-seat basis. (i.e. holiday charters, flag-carriers, and low-cost airlines).</li><li><code>BUSINESS</code> for flights that are operated to transport private individuals on business trips.</li><li><code>LEISURE</code> for any flight operated for leisure or pleasure, and that do not fall in any other category. </li><li><code>FERRY</code> for any flight operated for the purpose of moving the aircraft from one airport to another.</li><li><code>AERIAL\_WORK</code> for flights operated for hire  or rewars on certain specialised services. For example, agriculture, construction, photography, surveying, observation and patrol, and aerial advertisement.</li></ul><p>An empty list indicates that there are no specific flight purpose requirements for flights. I.e. any flight, regardless of its purpose, can operate.</p>                                                                                                                                                                                                                                           |
| `direction` | String, `null` | <p>The direction in which the flight operates, either:</p><ul><li><code>DEPARTURE</code> for departing flights, or</li><li><code>ARRIVAL</code> for arriving flights.</li></ul><p><code>null</code> indicates that both departures and arrivals are allowed.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

Each `openFor` object contains further properties to describe the conditions that need to be satisfied for the airport to be available to the flights listed.

These additional properties are:

| Property              | Type           | Description                                                                                                                                                                                                |
| --------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `priorNoticeRequired` | Number, `null` | The number of hours, ahead of the movement time, required to give notice of a movement. `0` indicates that notice is required, but availability is immediate. `null` indicates that no notice is required. |
| `costsInvolved`       | Boolean        | Indicates if there are additional costs involved in accessing the airport for the specific type of flight.                                                                                                 |
| `other`               | String         | Any additional condition that cannot otherwise be described.                                                                                                                                               |

### `ciq` Availability <a href="#ciq-availability" id="ciq-availability"></a>

CIQ (Customs Immigration and Quarantine) Availability indicates the availability of Customs and Immigration facilities to process aircraft, crew, passengers and cargo as required by local regulations.

The `info` object for CIQ Availability can only contain `notes`, if applicable.

### `atc` Availability <a href="#atc-availability" id="atc-availability"></a>

ATC (Air Traffic Control) Availability indicates the availability of Air Traffic Services to support aircraft during the final descent, landing and ground movement.

The `info` object for ATC Availability have the following properties in addition to the base model described before:

* `afisOnly` a boolean which when `true` indicates that only AFIS (Aerodrome Flight Information Service) is provided.
* `enRtfAvailable` a boolean which when `true` indicates that English Radiotelephony is available. This simply means that the radio operator can speak English.

### `arff` Availability <a href="#arff-availability" id="arff-availability"></a>

ARFF (Airport Rescue and Fire Fighting) Availability indicates the availability of Rescue and Fire Fighting services to attend in case of an emergency.

The `info` object for ARFF Availability have the following properties in addition to the base model described before:

* `icaoCatAirplane` indicates the ICAO Rescue and Fire Fighting category for airplanes (not helicopters). Possible values are `NONE`, `I`, `II`, `III`, `IV`, `V`, `VI`, `VII`, `VIII`, `IX`, `X`. `null` means the information is not available.
* `faaCatAirplane` indicates the FAA category. Possible values are `NONE`, `A`, `B`, `C`, `D`, `E`. `null` indicates that the information is not available.
* `faa139Certified` boolean that indicates if the airport is certified according to 14 CFR §139. If true, it means the basis for the ARFF certification are the US rules, which don’t allow for immediate conversion of `faaCatAirplane` to `icaoCatAirplane`. If `true` it indicates that `icaoCatAirplane` was a value calculated based on the values of `waterQuantity`, `complementaryQuantity`, `arffVehicles`, and `dischargeCapacity`.
* `catHelicopters` indicates the ARFF value for helicopters. Possible values are `NONE`, `I`, `II`, `III`, `IV`. `null` if the information is not available.
* `waterQuantity` the total water capacity of all ARFF vehicles available, in litres.
* `complementaryQuantity` the total capacity of Complimentary Extinguishing Agent available, in kilograms. null if the information is not available.
* `arffVehicles` the number of ARFF vehicles available. `null` if the information is not available.
* `dischargeCapacity` the total discharge capacity of all ARFF vehicles available, in litres per minute. `null` if the information is not available.
* `extensionAvailable` boolean which indicates if an upgrade of the ARFF to a higher category can be arranged. `null` if the information is not available.
* `extensionNotice` amount of hours required to obtain ARFF extension before departure or arrival. `null` if the information is not available.
* `extensionUpToIcao` the maximum ARFF obtainable with extension. This is only available in ICAO format. Possible values are as per `icaoCatAirplane`. `null` if the information is not available.
* `firestationRemote` boolean which indicates if the ARFF service is offered by a remote fire station, not located at the airfield, for example, a village fire station. `null` if the information is not available.
* `firestationNotes` if `firestationRemote` is `true`, this text field allows notes about the location and performance of the remote fire station, for example, to indicate the response time.

### The `openingIndicator` flag <a href="#the-openingindicator-flag" id="the-openingindicator-flag"></a>

This indicator is produced by the backend and takes into consideration all 4 availabilities at the current time.

Possible values are:

* `OPEN` to indicate that all facilities are fully available.
* `SEE_TIMES` to indicate that some, potentially non-critical, facilities are not fully available and that the user should check full details.
* `CLOSED` to indicate that either `movemet` or all facilities are not available.
* `UNKNOWN` to indicate that there is not enough information to determine the current opening status of the location.

For client implementation, it is recommended that only `OPEN` and `CLOSED` statuses are used for decision-making, and that any other status is analyzed in more details or referred to a human for exception management.
