defmodule EnvGuard.Types do
@moduledoc """
Shared type definitions for the supported cast targets and constraints.
These are the single source of truth referenced by `EnvGuard`,
`EnvGuard.Cast`, and `EnvGuard.Constraints`, and must enumerate exactly the
clauses those modules implement.
"""
@typedoc "A type an environment variable value can be cast to."
@type type ::
:boolean
| :string
| :atom
| :charlist
| :integer
| :float
| {:list, type()}
| {:enum, [String.t()]}
@typedoc "A constraint that can be checked against a cast value."
@type constraint ::
{:length, integer()}
| {:min_length, integer()}
| {:max_length, integer()}
| {:min, integer()}
| {:max, integer()}
| {:allow_empty?, boolean()}
end