# `PhoenixKitAgent.Schemas.Attachment`
[🔗](https://github.com/BeamLabEU/phoenix_kit_agent/blob/v0.1.0/lib/phoenix_kit_agent/schemas/attachment.ex#L1)

A file attached to a message (`phoenix_kit_agent_attachments`). The bytes live
in Storage, in the module's hidden library (`file_uuid`); the row keeps what
the model reads: the extracted text of a PDF or a sheet, truncated to a limit.

`status` goes `pending` → `ready` | `failed`; a failed row keeps a code in
`error` (see `PhoenixKitAgent.Attachments.Processor`), never text of the file.
A `ready` picture or scanned PDF has no `extracted_text`: the model is shown
its pixels in the turn that sends it.

`conversation_uuid`, `message_uuid`, `user_uuid` and `file_uuid` are set by the
caller, never cast.

# `t`

```elixir
@type t() :: %PhoenixKitAgent.Schemas.Attachment{
  __meta__: term(),
  content_type: term(),
  conversation: term(),
  conversation_uuid: term(),
  error: term(),
  extracted_text: term(),
  file: term(),
  file_uuid: term(),
  filename: term(),
  inserted_at: term(),
  kind: term(),
  message: term(),
  message_uuid: term(),
  pages: term(),
  size_bytes: term(),
  status: term(),
  truncated: term(),
  user: term(),
  user_uuid: term(),
  uuid: term()
}
```

# `changeset`

```elixir
@spec changeset(t(), map()) :: Ecto.Changeset.t()
```

Builds an attachment from its file description and processing state.

# `kinds`

```elixir
@spec kinds() :: [String.t()]
```

The kinds of attachment: `image`, `pdf`, `sheet`, `text`.

---

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