# Events

## Meaning

An Event is a named semantic occurrence in authored software. It describes that something meaningful happened without binding the occurrence to a broker, queue, WebSocket library, callback mechanism, framework event object, or delivery product.

Events are defined once and referenced by other semantic systems.

## Canonical shape

An Event may define:

- optional `group`;
- optional description/semantic metadata;
- optional direct payload value;
- zero or more typed listeners.

Example:

```yaml
events:
  users.UserCreated:
    group:
      $ref: "#/groups/users"
    payload:
      $ref: "#/schemas/users.User"
    listeners:
      - kind: operation
        operation:
          $ref: "#/operations/notifications.SendWelcomeEmail"
      - kind: workflow
        workflow:
          $ref: "#/workflows/users.Onboarding"
```

## Payload

An Event payload is a direct `ValueRef`:

```text
PropertyRef | SchemaRef
```

It is not an arbitrary `TypeExpression`.

If a richer payload shape is needed, that meaning must first be expressed as a reusable Property or Schema.

Omitting `payload` means the Event carries no canonical value payload.

## Listeners

Listeners belong to the Event.

Canonical listener kinds are currently:

```text
operation
workflow
```

An Operation listener references one Operation. A Workflow listener references one Workflow.

When an Event has a payload, a direct listener must expose exactly one compatible input value. When an Event has no payload, it cannot directly satisfy listener inputs.

This rule makes Event-to-listener value flow explicit and deterministic.

## Emission versus listening

These are separate relationships:

```text
Operation -> emits -> Event
Event -> listeners -> Operation / Workflow
Workflow WaitStep -> waits for -> Event
```

An Operation's `emits` list records that the Operation may cause the occurrence.

The Event's `listeners` list records semantic consumers that are triggered by the occurrence.

A Workflow wait step records orchestration that pauses until the occurrence happens.

None of these relationships should be collapsed into a detached transport declaration.

## Removed model

There is no root Event exposure and no `EventExposure` contract.

Do not represent:

```yaml
exposures:
  Something:
    kind: event
    event: ...
    operation: ...
```

There is no root `exposures` registry at all.

## Boundaries

Events do not define broker topics, queues, WebSocket channels, HTTP callbacks, retry products, delivery guarantees, consumer group names, or framework handlers.

Those implementation details remain pack/runtime concerns unless a future canonical semantic contract is explicitly approved.

Event identity and payload/listener meaning remain portable across implementations.
