# ChatSession

**Kind:** Database Model

**Source:** [`atloria-monorepo/libs/database/prisma/schema.prisma`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/database/prisma/schema.prisma#L2102)

## Fields

| Field | Type | Required | Key |
|---|---|---|---|
| `id` | `String` | ✓ | PK |
| `sessionId` | `String` | ✓ | unique |
| `projectId` | `String` | ✓ |  |
| `agentId` | `String` | ✓ |  |
| `language` | `String` | ✓ |  |
| `startedAt` | `DateTime` | ✓ |  |
| `endedAt` | `DateTime` | - |  |
| `interactions` | `ChatInteraction[]` | ✓ |  |
| `messages` | `ChatMessage[]` | ✓ |  |

## Diagram

```mermaid
erDiagram
    ChatSession {
        id String [PK]
        sessionId String [UNIQUE]
        projectId String
        agentId String
        language String
        startedAt DateTime
        endedAt DateTime?
        interactions ChatInteraction[]
        messages ChatMessage[]
    }
    ChatSession ||--|| Project : ""
    ChatSession ||--|| SupportAgentConfig : ""
```

## Relationships

- HAS_ONE → `Project`
- HAS_ONE → `SupportAgentConfig`

## Referenced By

- `ChatInteraction` (HAS_ONE)
- `ChatMessage` (HAS_ONE)
