<script>
	import Callout from '$lib/components/Callout.svelte';
</script>

dd-cards talks to the rest of your server through **bridges** — one small file per supported
resource. Each category resolves independently at boot, so the combination is yours to pick.

## Supported resources

| Category     | Ships with                     | Config option                  | Fallback when none is running |
| ------------- | -------------------------------- | --------------------------------- | -------------------------------- |
| Framework    | `qbx_core`, `qb-core`          | `Config.Framework`             | **Errors** — one is required  |
| Inventory    | `ox_inventory`, `qb-inventory` | `Config.Inventory`             | **Errors** — one is required  |
| Interaction  | `ox_target`, `qb-target`       | `Config.Interaction`           | `ox_lib` walk-up prompt       |
| Menu         | `ox_lib`, `qb-menu`            | `Config.Menu`                  | `ox_lib` context menu         |
| Notification | `lb-phone`, `npwd`, `qb-phone` | `Config.Notification.provider` | `ox_lib` notification         |

Framework and inventory are chosen **independently**. Running QBCore with ox_inventory, or Qbox with
qb-inventory, is fully supported.

## How `'auto'` resolves

Every category accepts `'auto'`, which picks whichever supported resource is actually started, in a
fixed preference order:

```lua
Framework    → qbx_core, then qb-core
Inventory    → ox_inventory, then qb-inventory
Interaction  → ox_target, then qb-target, then ox_lib
Notification → lb-phone, then npwd, then qb-phone, then ox_lib
```

`'auto'` is worth leaving on: it keeps working if you swap resources later.

<Callout type="warning">
`'auto'` can never resolve to `qb-menu` or `qb-drawtext`. ox_lib is a hard dependency, so it is
always present and always wins the fallback. If you want either of those, name it explicitly in
the config.
</Callout>

## Interaction without a targeting resource

With neither ox_target nor qb-target installed, dd-cards falls back to a walk-up prompt: a textUI
appears as you approach the ped and a key opens the menu. Two prompt styles ship:

- **`'ox_lib'`** — ox_lib's textUI. Always available, since ox_lib is a hard dependency.
- **`'qb-drawtext'`** — qb-core's own drawtext, so the prompt matches the rest of a QBCore server.
  There is nothing extra to install — the prompt ships inside qb-core — but qb-core does have to be
  started, and dd-cards errors at boot if it is not.

Both share the same `Config.DrawText` options, so switching between them needs no other edit.

## Known qb-menu limitations

Choosing `Config.Menu = 'qb-menu'` changes two behaviours. Both are limitations of qb-menu rather
than oversights:

- **No back arrow.** A "Back" entry is added to sub-menus instead.
- **No live countdown.** qb-menu cannot report whether the player has closed the menu, so the order
  list's live refresh is disabled. Times are still correct each time the list is opened — reopening
  a menu the player had just dismissed would be far more annoying than a countdown that only moves
  on reopen.

## Offline notification delivery

If an order finishes while the player is offline, whether the notification reaches them depends on
how the phone addresses mail:

| Provider   | Delivers while offline | Why                                                                  |
| ----------- | ------------------------- | ----------------------------------------------------------------------- |
| `qb-phone` | Yes                    | Addresses by citizenid, so the mail is written straight to the inbox |
| `npwd`     | Yes                    | Addresses by citizenid                                               |
| `lb-phone` | No                     | Addresses by phone number, which only exists for a live session      |
| `ox_lib`   | No                     | On-screen notification; there is no inbox                            |

Either way the order finishes on time and waits for them in the Orders menu.

## Something not on this list?

Every bridge lives in `bridge/`, which is excluded from escrow and therefore editable. Adding
support for a resource dd-cards does not ship is a matter of copying the closest bridge file and
adapting a handful of functions — see [Custom bridges](/docs/dd-cards/bridges).
