# Fare Class Application API Implementation

The API supports the standard Fare Class Application (Record 1) workflows:

- Creating a new fare class
- Discontinuing an existing fare class
- Making Fare Class Construction (P02) changes

Each request sends a single fare class, including all Record 1 fields except **Location**, **Routing**, **Footnote 1**, **Footnote 2**, and **Directionality**. This includes the standard, everyday elements of Record 1:

- Fare Class Control fields required for every fare class: carrier, tariff, rule, fareClass, fareType, normalSpecial, display, owRt, 994 Override Date, 996 Note Text data, addon1, addon1Letter, addon2, and addon2Letter, as well as the `dblOwAllowed` and `nuc` Construction fields and the sequence/batch effective date.
- Up to 15 Fare Class Detail occurrences per sequence, including Prime RBD codes (`rbdCodeItems`), an existing RBD Table 999 reference (`rbd999`), Passenger Type Code and age restrictions, ticket designator/code and modifiers, and commercial name.
- 994 Override Date and 996 Note Text: Reference an existing table, or supply the date/text fields inline so ATPCO creates a new table and returns its table number.
- Work Unit and Batch domain, including reusing an existing Work Unit ID or Batch ID or creating a new one.
- Auto-assigned sequence number (default `5,000,000`): Only one sequence/fare class is permitted per rule, so a duplicate fare class in the same rule is rejected.
- The following fields are ignored if a request includes them:

  - Location (`loc1` / `loc2`) and Directional Indicator (`dirInd`): These sequences always match broadly.
  - Routing Number (`rtgNum`) and Footnotes 1/2 (`ftn1` / `ftn2`).
  - Creation of a new RBD Table 999; only a reference to an existing table is accepted.
  - Multiple sequences for the same fare class.

You can also use the API to update or maintain a fare class that already exists, using two new action codes:

- `actionCode "X"` (Discontinue/Cancel): Discontinues an existing, distributed fare class sequence. Requires carrier, tariff, rule, fareClass, sequence number (`seqNum`), `seqEffDt` (used as the discontinue effective date), workUnit, and batch.
- `actionCode "C"` (Update Construction): Updates the Construction fields (`dblOwAllowed`, `nuc`, `addon1`, `addon1Letter`, `addon2`, and `addon2Letter`) on an existing sequence. Requires carrier, tariff, rule, and fareClass. The sequence number (`seqNum`) is not used because the match is by carrier/tariff/rule/fareClass rather than by sequence. Only the supplied Construction fields are updated; other fare class data is ignored.

## Future Enhancements

Location, Directional Indicator, Routing Number, Footnotes, and support for multiple sequences per fare class are planned for the future.
