# `JsonRemedy.LayerBehaviour`
[🔗](https://github.com/nshkrdotcom/json_remedy/blob/v0.2.1/lib/json_remedy/layer_behaviour.ex#L1)

Defines the contract that all repair layers must implement.

Each layer is responsible for one specific type of repair concern
and should be composable with other layers in the pipeline.

# `layer_result`
[🔗](https://github.com/nshkrdotcom/json_remedy/blob/v0.2.1/lib/json_remedy/layer_behaviour.ex#L23)

```elixir
@type layer_result() ::
  {:ok, String.t(), repair_context()}
  | {:continue, String.t(), repair_context()}
  | {:error, String.t()}
```

# `repair_action`
[🔗](https://github.com/nshkrdotcom/json_remedy/blob/v0.2.1/lib/json_remedy/layer_behaviour.ex#L9)

```elixir
@type repair_action() :: %{
  layer: atom(),
  action: String.t(),
  position: non_neg_integer() | nil,
  original: String.t() | nil,
  replacement: String.t() | nil
}
```

# `repair_context`
[🔗](https://github.com/nshkrdotcom/json_remedy/blob/v0.2.1/lib/json_remedy/layer_behaviour.ex#L17)

```elixir
@type repair_context() :: %{
  repairs: [repair_action()],
  options: keyword(),
  metadata: map()
}
```

# `name`
[🔗](https://github.com/nshkrdotcom/json_remedy/blob/v0.2.1/lib/json_remedy/layer_behaviour.ex#L54)

```elixir
@callback name() :: String.t()
```

Return a human-readable name for this layer.
Used in logging and debugging.

# `priority`
[🔗](https://github.com/nshkrdotcom/json_remedy/blob/v0.2.1/lib/json_remedy/layer_behaviour.ex#L48)

```elixir
@callback priority() :: non_neg_integer()
```

Return the priority order for this layer (lower = earlier).
Used to determine layer execution order.

# `process`
[🔗](https://github.com/nshkrdotcom/json_remedy/blob/v0.2.1/lib/json_remedy/layer_behaviour.ex#L36)

```elixir
@callback process(input :: String.t(), context :: repair_context()) :: layer_result()
```

Process input string and apply layer-specific repairs.

Returns:
- `{:ok, processed_input, updated_context}` - Layer completed successfully
- `{:continue, input, context}` - Layer doesn't apply, pass to next layer
- `{:error, reason}` - Layer failed, stop pipeline

# `supports?`
[🔗](https://github.com/nshkrdotcom/json_remedy/blob/v0.2.1/lib/json_remedy/layer_behaviour.ex#L42)

```elixir
@callback supports?(input :: String.t()) :: boolean()
```

Check if this layer can handle the given input.
Used for optimization and layer selection.

# `validate_options`
[🔗](https://github.com/nshkrdotcom/json_remedy/blob/v0.2.1/lib/json_remedy/layer_behaviour.ex#L60)
*optional* 

```elixir
@callback validate_options(options :: keyword()) :: :ok | {:error, String.t()}
```

Validate layer configuration and options.
Called during pipeline setup.

# `inside_string?`
[🔗](https://github.com/nshkrdotcom/json_remedy/blob/v0.2.1/lib/json_remedy/layer_behaviour.ex#L69)

```elixir
@spec inside_string?(input :: String.t(), position :: non_neg_integer()) :: boolean()
```

Check if a position in the input is inside a string literal.
Used to avoid applying repairs to string content.

---

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