# Reservations Import (CSV)

### **Format** <a href="#format" id="format"></a>

Comma Separated Value (CSV)

* Must use semi-colons (`;`) as field separator
* Only allowed encodings are `UTF-8` and `UTF-16`
* **Filename and folder conventions**:
  * The files need to be placed in the `/reservations` folder.
  * There's no explicit file naming convention e.g `reservations_snapshot.csv`

### Reservations file columns <a href="#sales-file-columns" id="sales-file-columns"></a>

| Column         | Data Type | Required | Description                                                                                         | E                      |
| -------------- | --------- | -------- | --------------------------------------------------------------------------------------------------- | ---------------------- |
| `ean`          | String    | Yes      | EAN of the reservation                                                                              | `4059701022541`        |
| `store_id`     | Integer   | No       | If provided, reservation is linked to a specific store/location. If omitted, reservation is global. | `1`                    |
| `order_number` | String    | No       | Order number                                                                                        | `10105483062`          |
| `timestamp`    | String    | No       | ISO 8061 timestamp. Only date `2024-06-03` is also possible.                                        | `2024-06-03T12:34:56Z` |

### Business Rules

* **One reservation = one row.**
* **No aggregation:** If a store has 3 reservations for the same `EAN`, include **3 separate rows** (duplicate rows allowed).
* **Deletions:** If a reservation disappears from the file (by `EAN` + `STORE_ID` combination, or just `EAN` if no store given), it is **removed**.
* **Optional store dimension:**
  * If `STORE_ID` is present → reservation is store-specific.
  * If `STORE_ID` is absent → reservation is global.

### Example CSV

```csv
ean,store_id
4062051234567,1
4062051234567,1
4056254363206
4056254363213,3
```

After import:

* Store `1` has **2 reservations** for `4062051234567`.
* There is also **1** **global reservation** for `4056254363206` (no `STORE_ID`).
* Store `3` has **1 reservation** for `4056254363213`.
* All other previous reservations are **deleted**.
