# Reading Converter

The `scripts/reading-converter.php` utility converts reading data between the Card Oracle JSON structure and a tabular CSV layout. It is standalone and does not depend on WordPress.

## CSV Schema

The converter expects a header row with the following columns:

```
type,reading_name,reading_image,reading_reversed,position_name,position_order,card_name,card_image,card_description,orientation,text_position,text_content
```

Row usage:

- `reading`: populate `reading_*` columns (only one row required).
- `position`: supply `position_name` and `position_order` per spread position.
- `card`: supply the metadata for each tarot card (`card_*` columns).
- `text`: map `card_name` + `orientation` (`upright` or `reverse`) + `text_position` to the HTML copy in `text_content`.

Only the columns relevant to a row type need data; unused columns should be left blank.

## Examples

Convert JSON to CSV for editing in a spreadsheet:

```sh
php scripts/reading-converter.php assets/readings/past_present_future.json /tmp/past-present-future.csv
```

Convert the edited CSV back into JSON:

```sh
php scripts/reading-converter.php /tmp/past-present-future.csv assets/readings/past_present_future.json
```

The utility infers the direction from the file extensions and writes pretty-printed JSON for readability.
