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

Money or Percentage (MOP) -- HL7v2 composite data type.

Transmits a monetary amount or a percentage.

2 components:
1. Money or Percentage Indicator (ID) -- AT (amount), PC (percentage)
2. Money or Percentage Quantity (NM)

# `t`

```elixir
@type t() :: %HL7v2.Type.MOP{
  money_or_percentage_indicator: binary() | nil,
  money_or_percentage_quantity: binary() | nil
}
```

# `encode`

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

Encodes a MOP to a list of component strings.

## Examples

    iex> HL7v2.Type.MOP.encode(%HL7v2.Type.MOP{money_or_percentage_indicator: "AT", money_or_percentage_quantity: "150.00"})
    ["AT", "150.00"]

    iex> HL7v2.Type.MOP.encode(%HL7v2.Type.MOP{money_or_percentage_indicator: "PC"})
    ["PC"]

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

# `parse`

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

Parses a MOP from a list of components.

## Examples

    iex> HL7v2.Type.MOP.parse(["AT", "150.00"])
    %HL7v2.Type.MOP{money_or_percentage_indicator: "AT", money_or_percentage_quantity: "150.00"}

    iex> HL7v2.Type.MOP.parse(["PC", "80"])
    %HL7v2.Type.MOP{money_or_percentage_indicator: "PC", money_or_percentage_quantity: "80"}

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

---

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