# 17. Aircraft Model and Operator Aliases

# Aircraft Model and Operator Aliases

These tools live in the admin `Visuals` group:
1. `/admin/aircraft-model-mappings` - menu label `Aircraft Models`,
2. `/admin/operator-aliases` - menu label `Operator Aliases`.

They are still present in the admin panel. If they are not visible, expand `Visuals` in the left menu or open the direct routes above.

## 1. Aircraft Models

`Aircraft Models` maps an ICAO aircraft type code to a readable model name.

Use it when aircraft have a type code such as `A321`, `B738`, or `B77W`, but the aircraft database record does not contain an exact model.

Runtime behavior:
1. an exact model from the aircraft database wins,
2. if the exact model is missing, VRS X looks up the ICAO type code in `Aircraft Models`,
3. if there is no mapping, the model remains empty.

Example:
1. type code: `A321`,
2. model name: `Airbus A321`,
3. aircraft without an exact database model can display `Airbus A321`.

Validation:
1. ICAO type code must be `2-8` characters,
2. allowed type code characters are `A-Z` and `0-9`,
3. model name is required and is stored trimmed,
4. very long model names are shortened to 160 characters.

CSV import:
1. file extension must be `.csv`,
2. maximum upload size is `5 MB`,
3. format is semicolon-separated: `icao_type;model_name`,
4. optional headers such as `icao_type;model_name` are accepted,
5. duplicate ICAO type rows inside the same import are skipped,
6. existing mappings are updated when the imported model name changes.

Mappings are stored in `aircraft-model-mappings.json` in the VRS X data directory.

## 2. Operator Aliases

`Operator Aliases` maps an operator code to a carrier display name.

Use it when the aircraft list has a callsign/operator code such as `DLH`, `BAW`, or `RYR`, and you want the UI/API to expose a readable name such as `Lufthansa`, `British Airways`, or `Ryanair`.

Runtime behavior:
1. if the aircraft has `OperatorFlagCode`, that code is used first,
2. otherwise VRS X derives a code from the callsign prefix,
3. the derived callsign prefix must be two or three letters followed by a digit, for example `DLH123` -> `DLH`,
4. VRS X looks up that code in `Operator Aliases`,
5. the matched display name is exposed as `operatorName`.

Validation:
1. operator code must be `2-40` characters,
2. allowed characters are `A-Z`, `0-9`, `@`, `.`, `_`, `+`, and `-`,
3. display name is required and is stored trimmed.

CSV import:
1. file extension must be `.csv`,
2. maximum upload size is `5 MB`,
3. format is semicolon-separated: `code;display_name`,
4. optional header `code;display_name` is accepted,
5. existing aliases are updated when the imported display name changes.

Aliases are stored in `operator-aliases.json` in the VRS X data directory.

## 3. Relationship to colors and logos

These mappings do not replace resource files.

Use:
1. `Operator Aliases` for readable carrier names,
2. `Operator Colors` for marker tinting by operator code,
3. `Custom Operator Logo` for custom `OPERATOR.bmp/png` or `OPERATOR-ICAOTYPE.bmp/png` resources,
4. `Aircraft Models` for filling missing display model names by ICAO type.

If a logo or color does not apply, first verify which operator code the aircraft resolves to. The direct routes above are the fastest way to check and maintain mappings.