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

Address (AD) -- HL7v2 composite data type.

A simpler address type used in older HL7 versions. Superseded by XAD in v2.3+.

8 components:
1. Street Address (ST)
2. Other Designation (ST)
3. City (ST)
4. State or Province (ST)
5. Zip or Postal Code (ST)
6. Country (ID) -- Table 0399
7. Address Type (ID) -- Table 0190
8. Other Geographic Designation (ST)

# `t`

```elixir
@type t() :: %HL7v2.Type.AD{
  address_type: binary() | nil,
  city: binary() | nil,
  country: binary() | nil,
  other_designation: binary() | nil,
  other_geographic_designation: binary() | nil,
  state_or_province: binary() | nil,
  street_address: binary() | nil,
  zip_or_postal_code: binary() | nil
}
```

# `encode`

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

Encodes an AD to a list of component strings.

## Examples

    iex> HL7v2.Type.AD.encode(%HL7v2.Type.AD{street_address: "123 Main St", city: "Springfield", state_or_province: "IL"})
    ["123 Main St", "", "Springfield", "IL"]

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

# `parse`

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

Parses an AD from a list of components.

## Examples

    iex> HL7v2.Type.AD.parse(["123 Main St", "Suite 100", "Springfield", "IL", "62704", "USA"])
    %HL7v2.Type.AD{street_address: "123 Main St", other_designation: "Suite 100", city: "Springfield", state_or_province: "IL", zip_or_postal_code: "62704", country: "USA"}

    iex> HL7v2.Type.AD.parse(["456 Oak Ave"])
    %HL7v2.Type.AD{street_address: "456 Oak Ave"}

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

---

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