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

Money (MO) -- HL7v2 composite data type.

Used for monetary amounts with optional denomination.

2 components:
1. Quantity (NM)
2. Denomination (ID) -- ISO 4217 currency code (e.g., USD, EUR)

# `t`

```elixir
@type t() :: %HL7v2.Type.MO{denomination: binary() | nil, quantity: binary() | nil}
```

# `encode`

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

Encodes an MO to a list of component strings.

## Examples

    iex> HL7v2.Type.MO.encode(%HL7v2.Type.MO{quantity: "150.00", denomination: "USD"})
    ["150.00", "USD"]

    iex> HL7v2.Type.MO.encode(%HL7v2.Type.MO{quantity: "250"})
    ["250"]

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

# `parse`

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

Parses an MO from a list of components.

## Examples

    iex> HL7v2.Type.MO.parse(["150.00", "USD"])
    %HL7v2.Type.MO{quantity: "150.00", denomination: "USD"}

    iex> HL7v2.Type.MO.parse(["250"])
    %HL7v2.Type.MO{quantity: "250"}

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

---

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