# `XlsxWriter.Validation`

Validation functions for XlsxWriter inputs.

This module provides validation helpers to ensure data integrity
and provide helpful error messages before data reaches the Rust NIF.

# `validate_cell_position!`

Validates that row and column indices are non-negative.

## Parameters
- `row` - The row index (0-based)
- `col` - The column index (0-based)

## Raises
- `ArgumentError` if row or column is negative

## Examples

    iex> XlsxWriter.Validation.validate_cell_position!(0, 0)
    :ok

    iex> XlsxWriter.Validation.validate_cell_position!(-1, 0)
    ** (ArgumentError) Row index must be non-negative, got: -1

# `validate_formats!`

Validates format options list, ensuring color values are strings.

Checks all color-related format options to ensure they receive
string hex color values (e.g., "#FF0000") and not other types
like booleans or integers.

## Parameters
- `formats` - List of format tuples

## Raises
- `ArgumentError` if any color option has a non-string value

## Examples

    iex> XlsxWriter.Validation.validate_formats!([:bold, {:bg_color, "#FF0000"}])
    :ok

    iex> XlsxWriter.Validation.validate_formats!([{:font_color, true}])
    ** (XlsxWriter.Error) Format option :font_color expects a string hex color (e.g., "#FF0000"), got: true

# `validate_image_binary!`

Validates that image binary data is not empty.

## Parameters
- `image_binary` - Binary data for the image

## Raises
- `ArgumentError` if binary is empty

## Examples

    iex> XlsxWriter.Validation.validate_image_binary!(<<1, 2, 3>>)
    :ok

    iex> XlsxWriter.Validation.validate_image_binary!(<<>>)
    ** (ArgumentError) Image binary cannot be empty

# `validate_rich_string_segments!`

Validates rich string segments.

Each segment must be a tuple of `{text, formats}` where:
- `text` is a binary string
- `formats` is a list of format options

## Parameters
- `segments` - List of segment tuples

## Raises
- `ArgumentError` if segments is not a list
- `ArgumentError` if any segment is not a valid `{text, formats}` tuple

## Examples

    iex> XlsxWriter.Validation.validate_rich_string_segments!([{"Bold ", [:bold]}, {"Normal", []}])
    :ok

    iex> XlsxWriter.Validation.validate_rich_string_segments!([])
    ** (ArgumentError) Rich string segments cannot be empty

    iex> XlsxWriter.Validation.validate_rich_string_segments!("not a list")
    ** (ArgumentError) Rich string segments must be a list, got: "not a list"

# `validate_supported_type!`

Validates that a value is a supported data type.

## Parameters
- `value` - The value to validate

## Raises
- `ArgumentError` if the data type is not supported

## Examples

    iex> XlsxWriter.Validation.validate_supported_type!("string")
    :ok

    iex> XlsxWriter.Validation.validate_supported_type!(123)
    :ok

    iex> XlsxWriter.Validation.validate_supported_type!(self())
    ** (XlsxWriter.Error) The data type for value "#PID<0.123.0>" is not supported.

---

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