# `OCSF.Severity`
[🔗](https://github.com/docjerem/ocsf/blob/v0.1.0/lib/ocsf/severity.ex#L1)

OCSF severity levels.

Maps human-readable severity names to their OCSF 1.8 numeric
identifiers. Used by event builders to resolve the `:severity`
keyword into the `severity_id` field.

See the OCSF
[severity_id](https://schema.ocsf.io/1.8.0/data_types/integer?caption=severity_id)
definition.

## Values

| Name             | ID |
|------------------|----|
| `:Unknown`       | 0  |
| `:Informational` | 1  |
| `:Low`           | 2  |
| `:Medium`        | 3  |
| `:High`          | 4  |
| `:Critical`      | 5  |
| `:Fatal`         | 6  |
| `:Other`         | 99 |

See `OCSF.Status` for event outcome status.

# `ecto_values`

```elixir
@spec ecto_values() :: keyword()
```

Return values formatted for `Ecto.Enum`.

## Examples

    iex> OCSF.Severity.ecto_values()
    [Unknown: 0, Informational: 1, Low: 2, Medium: 3, High: 4, Critical: 5, Fatal: 6, Other: 99]

# `name`

```elixir
@spec name(integer()) :: atom() | nil
```

Return the name atom for the given numeric identifier.

## Examples

    iex> OCSF.Severity.name(1)
    :Informational

    iex> OCSF.Severity.name(42)
    nil

# `uid`

```elixir
@spec uid(atom()) :: integer() | nil
```

Return the numeric identifier for the given name atom.

## Examples

    iex> OCSF.Severity.uid(:Informational)
    1

    iex> OCSF.Severity.uid(:NonExistent)
    nil

# `valid?`

```elixir
@spec valid?(atom() | integer()) :: boolean()
```

Return true if the given name or identifier is valid.

## Examples

    iex> OCSF.Severity.valid?(:Informational)
    true

    iex> OCSF.Severity.valid?(1)
    true

    iex> OCSF.Severity.valid?(:NonExistent)
    false

# `values`

```elixir
@spec values() :: [{atom(), integer()}]
```

Return all values as a keyword list.

## Examples

    iex> OCSF.Severity.values()
    [Unknown: 0, Informational: 1, Low: 2, Medium: 3, High: 4, Critical: 5, Fatal: 6, Other: 99]

---

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