# `LightningWeb.Live.AiAssistant.PaginationMeta`
[🔗](https://github.com/OpenFn/lightning/blob/main/lib/lightning_web/live/ai_assistant/pagination_meta.ex#L1)

Pagination metadata for AI Assistant sessions.

Handles offset-based pagination and infinite scroll patterns.

# `t`

```elixir
@type t() :: %LightningWeb.Live.AiAssistant.PaginationMeta{
  current_page: pos_integer(),
  has_next_page: boolean(),
  has_prev_page: boolean(),
  page_size: pos_integer(),
  total_count: non_neg_integer()
}
```

# `current_offset`

```elixir
@spec current_offset(t()) :: non_neg_integer()
```

Calculates database offset for current page.

# `first_page?`

```elixir
@spec first_page?(t()) :: boolean()
```

Checks if on first page.

# `for_page`

```elixir
@spec for_page(t(), pos_integer()) :: t()
```

Creates metadata for a specific page.

# `last_page?`

```elixir
@spec last_page?(t()) :: boolean()
```

Checks if on last page.

# `new`

```elixir
@spec new(non_neg_integer(), pos_integer(), non_neg_integer()) :: t()
```

Creates pagination metadata from current state.

## Examples

    iex> new(25, 20, 100)
    %PaginationMeta{current_page: 2, page_size: 20, total_count: 100, has_next_page: true, has_prev_page: true}

# `page_range`

```elixir
@spec page_range(t(), pos_integer()) :: [pos_integer()]
```

Returns page numbers for navigation display.

Centers around current page with max visible pages.

# `summary`

```elixir
@spec summary(t()) :: String.t()
```

Generates human-readable pagination summary.

## Examples

    iex> summary(%PaginationMeta{current_page: 2, page_size: 20, total_count: 45})
    "Showing 21-40 of 45"

# `total_pages`

```elixir
@spec total_pages(t()) :: pos_integer()
```

Calculates total number of pages.

---

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