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

Processing Type (PT) -- HL7v2 composite data type.

Used in MSH-11 to indicate processing mode.

2 components:
1. Processing ID (ID) -- Table 0103: D (Debugging), P (Production), T (Training)
2. Processing Mode (ID) -- Table 0207: A (Archive), R (Restore), I (Initial), T (Current)

# `t`

```elixir
@type t() :: %HL7v2.Type.PT{
  processing_id: binary() | nil,
  processing_mode: binary() | nil
}
```

# `encode`

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

Encodes a PT to a list of component strings.

## Examples

    iex> HL7v2.Type.PT.encode(%HL7v2.Type.PT{processing_id: "P"})
    ["P"]

    iex> HL7v2.Type.PT.encode(%HL7v2.Type.PT{processing_id: "P", processing_mode: "T"})
    ["P", "T"]

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

# `parse`

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

Parses a PT from a list of components.

## Examples

    iex> HL7v2.Type.PT.parse(["P"])
    %HL7v2.Type.PT{processing_id: "P"}

    iex> HL7v2.Type.PT.parse(["P", "T"])
    %HL7v2.Type.PT{processing_id: "P", processing_mode: "T"}

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

---

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