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

`config/server.lua` holds the four options that only the server reads.

## AutoInsertSql

Create the database tables automatically on start.

```lua
AutoInsertSql = true,
```

| Value   | Behaviour                                                             |
| ------- | ------------------------------------------------------------------------ |
| `true`  | dd-cards runs `install/sql/dd-cards.sql` itself at boot               |
| `false` | Nothing is run — import the SQL yourself before starting the resource |

Every statement in the file is `CREATE TABLE IF NOT EXISTS`, so on a server that already has the
tables this does nothing at all. It will not touch, reset or migrate existing data.

Leave it on unless your host restricts what the server user may `CREATE`, or you prefer to apply
schema changes by hand.

<Callout type="warning">
With `AutoInsertSql = false` and the SQL not imported, the **first order will fail** because the
tables are missing.
</Callout>

## EnableFreehandDrawing

Whether players may draw freehand on a card.

```lua
EnableFreehandDrawing = true,
```

<Callout type="warning">
This is enforced on the server, not just hidden in the UI. When `false`, freehand strokes are
stripped from the submitted design as well, so a modified client cannot sneak them through.
</Callout>

## DefaultPaymentMethod

Which payment option is pre-selected in the order step.

```lua
DefaultPaymentMethod = 'cash',
```

| Value    | Behaviour                         |
| -------- | ------------------------------------ |
| `'cash'` | Takes it from the player's pocket |
| `'bank'` | Takes it from their bank balance  |

Players can always switch before submitting; the server charges whichever they actually chose.

## Notification

How the player is told their order is ready.

```lua
Notification = {
    provider = 'auto',
    useMail = true,
    sender = 'Business Card Fabric',
},
```

### `provider`

| Value        | Behaviour                                                                                                                               |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `'auto'`     | Use whichever supported phone is running — lb-phone, then npwd, then qb-phone — and fall back to a plain ox_lib notification if none is |
| `'lb-phone'` | LB Phone                                                                                                                                |
| `'npwd'`     | npwd, through its mail app                                                                                                              |
| `'qb-phone'` | qb-phone, through its mail app                                                                                                          |
| `'ox_lib'`   | Plain on-screen notification, no phone required                                                                                         |

### `useMail`

Phone providers deliver a mail that stays in the inbox rather than a push notification that vanishes
when dismissed.

**Recommended `true`:** an order becomes ready minutes later, while the player is busy elsewhere. Set
`false` to get a push notification instead where the phone supports one. Ignored by the `'ox_lib'`
provider, which has no inbox.

### `sender`

Name the mail appears to come from. Defaults to `'Business Card Fabric'`.

### Offline players

qb-phone and npwd address mail by citizenid, so a mail sent while the player is offline is written
straight to their inbox and is waiting at their next login.

lb-phone addresses by phone number, which only exists for a live session, so it cannot deliver to an
offline player.

Either way the order finishes on time and waits for them in the Orders menu — the notification is a
convenience, not the delivery mechanism.
