# `Spectre.Operation.Delivery.Policy`
[🔗](https://github.com/elchemista/spectre/blob/0.3.0/lib/spectre/operation/delivery/policy.ex#L1)

Deterministic consent, deduplication, rate and quiet-hours policy.

# `t`

```elixir
@type t() :: %Spectre.Operation.Delivery.Policy{
  channels: term(),
  consent_required: term(),
  dedupe_ttl_ms: term(),
  event_types: term(),
  max_deliveries: term(),
  metadata: term(),
  mode: term(),
  quiet_hours: term(),
  utc_offset_minutes: term(),
  window_ms: term()
}
```

# `new`

```elixir
@spec new(t() | map() | keyword() | nil) :: t()
```

Builds a validated policy from a struct, map, keyword list or `nil`.

`nil` yields the default policy. Raises `ArgumentError` when the resulting
policy is invalid.

# `validate`

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

Validates the policy's flags, limits, quiet hours, offset, mode and portability.

Returns `:ok`, or `{:error, reason}` naming the first invalid field.

---

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