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

Extended Telecommunication Number (XTN) -- HL7v2 composite data type.

12 components:
1. Telephone Number (ST) -- deprecated
2. Telecommunication Use Code (ID) -- Table 0201: PRN, WPN, NET, etc.
3. Telecommunication Equipment Type (ID) -- Table 0202: PH, FX, CP, Internet, etc.
4. Email Address (ST)
5. Country Code (NM)
6. Area/City Code (NM)
7. Local Number (NM)
8. Extension (NM)
9. Any Text (ST)
10. Extension Prefix (ST)
11. Speed Dial Code (ST)
12. Unformatted Telephone Number (ST)

# `t`

```elixir
@type t() :: %HL7v2.Type.XTN{
  any_text: binary() | nil,
  area_code: binary() | nil,
  country_code: binary() | nil,
  email_address: binary() | nil,
  extension: binary() | nil,
  extension_prefix: binary() | nil,
  local_number: binary() | nil,
  speed_dial_code: binary() | nil,
  telecom_equipment_type: binary() | nil,
  telecom_use_code: binary() | nil,
  telephone_number: binary() | nil,
  unformatted_telephone_number: binary() | nil
}
```

# `encode`

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

Encodes an XTN to a list of component strings.

## Examples

    iex> HL7v2.Type.XTN.encode(%HL7v2.Type.XTN{telecom_use_code: "NET", telecom_equipment_type: "Internet", email_address: "john@example.com"})
    ["", "NET", "Internet", "john@example.com"]

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

# `parse`

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

Parses an XTN from a list of components.

## Examples

    iex> HL7v2.Type.XTN.parse(["", "PRN", "PH", "", "34", "961", "123456", "789"])
    %HL7v2.Type.XTN{
      telecom_use_code: "PRN",
      telecom_equipment_type: "PH",
      country_code: "34",
      area_code: "961",
      local_number: "123456",
      extension: "789"
    }

    iex> HL7v2.Type.XTN.parse(["", "NET", "Internet", "john@example.com"])
    %HL7v2.Type.XTN{
      telecom_use_code: "NET",
      telecom_equipment_type: "Internet",
      email_address: "john@example.com"
    }

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

---

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