# `HL7v2.Type.DTN`
[🔗](https://github.com/Balneario-de-Cofrentes/hl7v2/blob/v3.10.1/lib/hl7v2/type/dtn.ex#L1)

Day Type and Number (DTN) -- HL7v2 composite data type.

Specifies a day type and the number of days for insurance certification.

2 components:
1. Day Type (IS) -- Table 0149: e.g., "AP" (approved), "DE" (denied), "PE" (pending)
2. Number of Days (NM) -- the number of days

# `t`

```elixir
@type t() :: %HL7v2.Type.DTN{
  day_type: binary() | nil,
  number_of_days: HL7v2.Type.NM.t() | nil
}
```

# `encode`

```elixir
@spec encode(t() | nil) :: list()
```

Encodes a DTN to a list of component strings.

## Examples

    iex> HL7v2.Type.DTN.encode(%HL7v2.Type.DTN{day_type: "AP", number_of_days: %HL7v2.Type.NM{value: "10", original: "10"}})
    ["AP", "10"]

    iex> HL7v2.Type.DTN.encode(nil)
    []

# `parse`

```elixir
@spec parse(list()) :: t()
```

Parses a DTN from a list of components.

## Examples

    iex> HL7v2.Type.DTN.parse(["AP", "10"])
    %HL7v2.Type.DTN{day_type: "AP", number_of_days: %HL7v2.Type.NM{value: "10", original: "10"}}

    iex> HL7v2.Type.DTN.parse([])
    %HL7v2.Type.DTN{}

---

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