# Data Model

**Feature**: Anonymous Desire Aggregator
**Date**: 2025-10-09

This document defines the key data entities for the feature, with notes on where the state is managed.

---

### 1. Session

Represents a single decision-making event. **Note**: This object lives in the browser's Local Storage and is synchronized between clients via WebSocket messages.

| Attribute | Type | Description | Notes |
|---|---|---|---|
| `sessionId` | String | Unique identifier for the session. | The only piece of session data the backend is aware of. |
| `topic` | String | The subject of the session. | Set by the creator client. |
| `participantCount` | Integer | The number of expected participants. | Set by the creator client. |
| `status` | Enum | The current state of the session. | `WAITING`, `ANALYZING`, `COMPLETE`, `LOCKED`. |
| `participants` | Array\[Participant] | List of participants in the session. | Managed by clients. |
| `desireSets` | Array\[DesireSet] | List of all desire sets submitted by participants. | Managed by clients. |
| `decision` | Decision | The final calculated result. | Received from backend and stored by clients. |

---

### 2. Participant

Represents an anonymous user in the session. **Note**: Lives within the `Session` object in Local Storage.

| Attribute | Type | Description |
|---|---|---|
| `participantId` | String | Unique identifier for the participant (e.g., a random ID generated by the client). |
| `isCreator` | Boolean | Flag to identify the participant who initiated the session. |
| `hasSubmitted` | Boolean | Flag to indicate if the participant has submitted their desires. |

---

### 3. Desire Set

Represents the raw text input from a single participant. **Note**: Lives within the `Session` object in Local Storage.

| Attribute | Type | Description |
|---|---|---|
| `participantId` | String | The ID of the participant who submitted this set. |
| `wants` | Array\[String] | List of raw text desires the user wants. |
| `accepts` | Array\[String] | List of raw text desires the user accepts. |
| `noGoes` | Array\[String] | List of raw text desires the user does not want. |

---

### 4. Semantic Desire

Represents a unique conceptual desire identified by the LLM analysis. **Note**: This is a read-only, transient data structure. It exists in the `Decision` object.

| Attribute | Type | Description |
|---|---|---|
| `title` | String | The canonical name for the desire group. |
| `rawInputs` | Array\[String] | The list of original user text inputs that were grouped into this desire. |

---

### 5. Decision

Represents the final, categorized output of the analysis. **Note**: Lives within the `Session` object in Local Storage.

| Attribute | Type | Description |
|---|---|---|
| `goTos` | Array\[Semantic Desire] | Desires everyone wants. |
| `alsoGoods` | Array\[Semantic Desire] | Desires some want and others accept. |
| `considerables` | Array\[Semantic Desire] | Other desires that were wanted or accepted. |
| `noGoes` | Array\[Semantic Desire] | Desires that at least one person does not want. |
