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

Extended Composite Name and ID for Organizations (XON) -- HL7v2 composite data type.

10 components:
1. Organization Name (ST)
2. Organization Name Type Code (IS) -- Table 0204: A=Alias, D=Display, L=Legal
3. ID Number (NM) -- deprecated
4. Check Digit (NM)
5. Check Digit Scheme (ID) -- Table 0061
6. Assigning Authority (HD) -- sub-components delimited by `&`
7. Identifier Type Code (ID) -- Table 0203
8. Assigning Facility (HD) -- sub-components delimited by `&`
9. Name Representation Code (ID) -- Table 0465
10. Organization Identifier (ST)

# `t`

```elixir
@type t() :: %HL7v2.Type.XON{
  assigning_authority: HL7v2.Type.HD.t() | nil,
  assigning_facility: HL7v2.Type.HD.t() | nil,
  check_digit: binary() | nil,
  check_digit_scheme: binary() | nil,
  id_number: binary() | nil,
  identifier_type_code: binary() | nil,
  name_representation_code: binary() | nil,
  organization_identifier: binary() | nil,
  organization_name: binary() | nil,
  organization_name_type_code: binary() | nil
}
```

# `encode`

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

Encodes an XON to a list of component strings.

## Examples

    iex> HL7v2.Type.XON.encode(%HL7v2.Type.XON{organization_name: "General Hospital", organization_name_type_code: "L"})
    ["General Hospital", "L"]

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

# `parse`

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

Parses an XON from a list of components.

## Examples

    iex> HL7v2.Type.XON.parse(["General Hospital", "L", "", "", "", "HOSP&2.16.840.1.113883.19.4.6&ISO", "XX", "", "", "GH001"])
    %HL7v2.Type.XON{
      organization_name: "General Hospital",
      organization_name_type_code: "L",
      assigning_authority: %HL7v2.Type.HD{namespace_id: "HOSP", universal_id: "2.16.840.1.113883.19.4.6", universal_id_type: "ISO"},
      identifier_type_code: "XX",
      organization_identifier: "GH001"
    }

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

---

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