# `Minga.Buffer.SaveIntent`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga/buffer/save_intent.ex#L1)

Captured destination and overwrite policy for an explicit-path save.

The buffer process creates an intent before formatting starts and validates it again when the write commits. This keeps overwrite consent scoped to one target and lets persistence enforce exclusive creation when that target was absent.

# `expectation`

```elixir
@type expectation() :: :current_file | :absent | :any
```

# `origin_path`

```elixir
@type origin_path() :: String.t() | nil
```

# `t`

```elixir
@type t() :: %Minga.Buffer.SaveIntent{
  expectation: expectation(),
  origin_buffer: pid(),
  origin_path: origin_path(),
  overwrite: boolean(),
  target: String.t()
}
```

# `absent`

```elixir
@spec absent(String.t(), pid(), origin_path()) :: t()
```

Creates a non-forced intent for a destination that was absent when requested.

# `current_file`

```elixir
@spec current_file(String.t(), String.t(), boolean(), pid()) :: t()
```

Creates an intent for the buffer's current file.

# `overwrite`

```elixir
@spec overwrite(String.t(), pid(), origin_path()) :: t()
```

Creates an explicit overwrite intent for a captured destination.

# `validate`

```elixir
@spec validate(t(), pid()) :: :ok | {:error, :invalid_save_intent}
```

Validates that an intent has a coherent policy and belongs to the committing buffer.

---

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