# `PhoenixAI.Store.Message`
[🔗](https://github.com/franciscpd/phoenix-ai-store/blob/v0.1.0/lib/phoenix_ai/store/message.ex#L1)

A message within a conversation, wrapping `PhoenixAI.Message` with
persistence-specific fields such as `id`, `conversation_id`, `token_count`,
and `inserted_at`.

# `t`

```elixir
@type t() :: %PhoenixAI.Store.Message{
  content: String.t() | nil,
  conversation_id: String.t() | nil,
  id: String.t() | nil,
  inserted_at: DateTime.t() | nil,
  metadata: map(),
  pinned: boolean(),
  role: :system | :user | :assistant | :tool | nil,
  token_count: non_neg_integer() | nil,
  tool_call_id: String.t() | nil,
  tool_calls: [map()] | nil
}
```

# `from_phoenix_ai`

```elixir
@spec from_phoenix_ai(PhoenixAI.Message.t()) :: t()
```

Converts a `%PhoenixAI.Message{}` to a `%PhoenixAI.Store.Message{}`.

Store-specific fields (`id`, `conversation_id`, `token_count`, `inserted_at`)
are left as `nil` and should be populated by the adapter on persistence.

# `to_phoenix_ai`

```elixir
@spec to_phoenix_ai(t()) :: PhoenixAI.Message.t()
```

Converts a `%PhoenixAI.Store.Message{}` to a `%PhoenixAI.Message{}`.

Only maps fields that exist on the core struct: `role`, `content`,
`tool_call_id`, `tool_calls`, and `metadata`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
