# `Alaja.Structures.MessageInfo`
[🔗](https://github.com/Lorenzo-SF/alaja/blob/2.1.0/lib/alaja/structures/message_info.ex#L1)

Contains all information related to message printing.

## Fields

- `chunks`: List of ChunkText to print
- `align`: Alignment (:left, :center, :right, :justified)
- `padding`: Padding (integer or tuple {top, right, bottom, left})
- `add_line`: Additional lines (:before, :after, :both, :none)
- `raw_coords`: Coordinates for raw mode {x, y}

## Examples

    iex> MessageInfo.new([ChunkText.new("Hello")])
    %MessageInfo{chunks: [...], align: :left, padding: 0, ...}

    iex> MessageInfo.new([ChunkText.new("Hello")], align: :center, padding: 2)
    %MessageInfo{chunks: [...], align: :center, padding: 2, ...}

# `add_line`

```elixir
@type add_line() :: :before | :after | :both | :none
```

# `align`

```elixir
@type align() :: :left | :center | :right | :justified
```

# `padding`

```elixir
@type padding() :: integer() | {integer(), integer(), integer(), integer()}
```

# `t`

```elixir
@type t() :: %Alaja.Structures.MessageInfo{
  add_line: add_line(),
  align: align(),
  chunks: [Alaja.Structures.ChunkText.t()],
  padding: padding(),
  raw_coords: {integer(), integer()} | nil
}
```

# `get_text`

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

Gets the complete message text (without formatting).

## Examples

    iex> msg = MessageInfo.new(["Hello", " world"])
    iex> MessageInfo.get_text(msg)
    "Hello world"

# `get_width`

```elixir
@spec get_width(t()) :: integer()
```

Gets the message width (text length without formatting).

## Examples

    iex> msg = MessageInfo.new(["Hello world"])
    iex> MessageInfo.get_width(msg)
    11

# `new`

```elixir
@spec new(
  [String.t() | Alaja.Structures.ChunkText.t()],
  keyword()
) :: t()
```

Creates a new MessageInfo structure.

## Parameters

- `chunks` - List of ChunkText or strings (automatically converted)
- `opts` - Options:
  - `:align` - Alignment (default: :left)
  - `:padding` - Padding (default: 0)
  - `:add_line` - Additional lines (default: :none)
  - `:raw_coords` - Coordinates for raw mode (default: nil)

## Examples

    iex> MessageInfo.new(["Hello", " world"])
    %MessageInfo{chunks: [...], align: :left}

    iex> MessageInfo.new([ChunkText.new("Hello")], align: :center, padding: 2)
    %MessageInfo{chunks: [...], align: :center, padding: 2}

# `normalize_padding`

```elixir
@spec normalize_padding(padding()) :: {integer(), integer(), integer(), integer()}
```

Normalizes padding to tuple {top, right, bottom, left}.

## Examples

    iex> MessageInfo.normalize_padding(2)
    {2, 2, 2, 2}

    iex> MessageInfo.normalize_padding({1, 2, 3, 4})
    {1, 2, 3, 4}

---

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