# `PhoenixKitWarehouse.Transfer`
[🔗](https://github.com/BeamLabEU/phoenix_kit_warehouse/blob/0.4.0/lib/phoenix_kit_warehouse/schemas/transfer.ex#L1)

# `t`

```elixir
@type t() :: %PhoenixKitWarehouse.Transfer{
  __meta__: term(),
  cancelled_at: term(),
  created_by_uuid: term(),
  deleted_at: term(),
  deleted_by_uuid: term(),
  destination_location_uuid: term(),
  inserted_at: term(),
  lines: term(),
  note: term(),
  number: term(),
  performed_by_uuid: term(),
  received_at: term(),
  shipped_at: term(),
  source_location_uuid: term(),
  source_refs: term(),
  status: term(),
  storage_folder_uuid: term(),
  updated_at: term(),
  uuid: term()
}
```

# `cancel_changeset`

Changeset for cancelling a transfer (from `draft` or `in_transit`,
programmatic fields only — no cast). `attrs` carries `:performed_by_uuid`
and, only when cancelling from `in_transit`, `:lines` — the
reverse-posting audit snapshot (see
`PhoenixKitWarehouse.Transfers.cancel_transfer/2`). Cancelling from
`draft` never touches `:lines` since no stock movement happened yet.

# `changeset`

Changeset for creating/editing a draft transfer. Both locations may be
`nil` at this stage — the keeper hasn't necessarily chosen the source and
destination warehouses yet. They only become mandatory when shipping
(see `ship_changeset/3`).

# `correction_changeset`

Changeset for correcting a transfer (note + storage_folder only — lines/locations immutable once shipped).

# `receive_changeset`

Changeset for receiving a transfer (in_transit -> done, programmatic
fields only — no cast). Locations are already guaranteed to be set at
this point (the transfer went through `ship_changeset/3` first), but the
same `validate_required/2` is applied here too for symmetry and as a
guard against data corruption.

# `ship_changeset`

Changeset for shipping a transfer (draft -> in_transit, programmatic
fields only — no cast). Requires both locations to already be set on the
record (chosen earlier via `changeset/2`) and requires them to differ
from each other.

Note: `source_location_uuid`/`destination_location_uuid` are not part of
this changeset's own changes (they're read from `transfer`'s existing
data, unchanged), so the distinctness check is implemented via
`get_field/2` + `add_error/3` rather than `validate_change/3` — the
latter only inspects `changeset.changes` and never fires for a field that
isn't being changed. Mirrors the `validate_no_self_parent`/
`validate_not_self_parent` idiom used elsewhere in the PhoenixKit
ecosystem (`phoenix_kit_locations/schemas/space.ex`,
`phoenix_kit_catalogue/schemas/category.ex`).

# `soft_delete_changeset`

Changeset for soft-deleting a transfer.

# `statuses`

# `storage_changeset`

Changeset for setting the storage folder (programmatic — single field).

---

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