# bytEM template reference

Files under `schema/` are JSON starter payloads, not JSON Schema validators.
Empty values must be populated before publishing; a parseable template is not
a valid room event.

| Concept | Current reference | Maintained template |
| --- | --- | --- |
| Operational role | [room-base-type](room-base-type.md) | `schema/room/room-base-type` |
| Discovery metadata | [room-index](room-index.md) | `schema/room/room-index` |
| Location | [Location authoring](location-authoring.md) | `schema/room/location-environment` |
| Supply assets | [supply-type](supply-type.md) | `schema/supply/supply-type-*.json` |
| Domain class | below | `schema/class.json` |
| Domain schema | below, and [chart](supply-type.md#chart) | `schema/domain-schema.json` |

A domain class is one `skos:Concept`: its `@id`, `skos:notation`, a label,
definition and scope note as plain language maps
(`{"en": "Land value", "de": "Bodenrichtwert"}`), `dcterms:publisher`, the
domain that defines it, and `dcterms:type`, the room type of its DEIDs (`https://bytem.app/class/Entity`, `Dataset`, `MapLayer` or
`Product`). It states `map` and `chart` where the data is drawn; a schema is
optional, and what the class states is read first.

A domain schema is needed only for the record shape: `@context`, `@type` (its
own URL), the fields with `(e)` marking extracted ones, e.g.
`"parameter": [{ "name": "(e)", "wert": "(e)" }]`, and `map` and `chart` when
the class states none. Neither carries a version, title, description or JSON
Schema keywords. A key no display or rule reads is left out.

A room's structural role (`entity`, `dataset`, `map_layer`, `product`) is not a
room event: it is the `skos:notation` of the term its class names in `dcterms:type`.

## Event type and state key

A room event is written with a Matrix **event type** taken from the bytEM
server's constants and a **state key** that is the same string.

| Template | Event type | `state_key` |
| --- | --- | --- |
| `room-base-type` | `bytem.app.room-base-type` | `bytem.app.room-base-type` |
| `room-deid` | `bytem.app.room-deid` | `bytem.app.room-deid` |
| `location-environment` | `bytem.app.location-environment` | `bytem.app.location-environment` |
| `market-status` | `bytem.app.market-status` | `bytem.app.market-status` |
| `price` | `bytem.app.price` | `bytem.app.price` |
| `exchange-policy` | `bytem.app.exchange-policy` | `bytem.app.exchange-policy` |

A room's stored state is addressed by its state key, so a changed key writes a
new state entry beside the existing one.

The legacy `DataSet` spelling remains for
compatibility. Download URLs, MIME types, sizes and dates need actual
resource metadata; instruction prose is not a field value.

The [OUDEA architecture](../schema/OUDEA/OUDEA-v0.10.md)
and [mapX](../schema/mapX/README.md) contain historical or proposed designs.
The per-concept references above describe the current implementation. The
[domain class catalogue](../schema/OUDEA/TYPES_and_CLASSES.md) is illustrative.
See [commands](../cmd/README.md)
for the current PWA terminal surface.

Hosted URL routing and deployment are outside this directory; changing these
files alone does not update bytem.app.
