# Server-Side

### 🔁 Core Framework Exports

#### `RegisterUsableItem(item, callback)`

Registers a usable item from inventory.

```lua
exports['devm-bridge']:RegisterUsableItem('usb', function(source)
    print(('Player %s used a USB'):format(source))
end)
```

***

#### `UseItem(id, item)`

Simulates a player using an item.

```lua
exports['devm-bridge']:UseItem(source, 'phone')
```

***

#### `AddMoney(id, amount)`

Adds **cash** to a player.

```lua
exports['devm-bridge']:AddMoney(source, 1000)
```

***

#### `RemoveMoney(id, amount)`

Removes **cash** from a player.

```lua
exports['devm-bridge']:RemoveMoney(source, 500)
```

***

#### `AddAccountMoney(id, account, amount)`

Adds money to a specific account:

* `cash`, `bank`, or `black_money` / `dirty_money`

If `Config.blackMoneyAsItem = true`, it uses inventory instead.

```lua
exports['devm-bridge']:AddAccountMoney(source, 'bank', 2000)
exports['devm-bridge']:AddAccountMoney(source, 'black_money', 100)
```

***

#### `RemoveAccountMoney(id, account, amount)`

Removes money from a specific account.

```lua
exports['devm-bridge']:RemoveAccountMoney(source, 'cash', 500)
```

***

#### `GetAccountMoney(id, account)`

Returns current balance of the selected account.

```lua
local bank = exports['devm-bridge']:GetAccountMoney(source, 'bank')
```

***

#### `GetJob(id)`

Returns the player’s job name.

```lua
local job = exports['devm-bridge']:GetJob(source)
print(job) -- e.g. "police"
```

***

#### `GetWeight(id)`

Returns current carried inventory weight.

```lua
local weight = exports['devm-bridge']:GetWeight(source)
print('Weight:', weight)
```

***

#### `GetIdentifier(id)`

Returns the player’s license identifier.

```lua
local license = exports['devm-bridge']:GetIdentifier(source)
print('License:', license)
```

***

#### `GetCoords(id)`

Returns player’s world coordinates.

```lua
local coords = exports['devm-bridge']:GetCoords(source)
print(json.encode(coords))
```

***

#### `GetName(id)`

Returns the player's full name.

```lua
local name = exports['devm-bridge']:GetName(source)
print('Name:', name)
```

***

#### `Kick(id, reason)`

Kicks the player with a custom reason.

```lua
exports['devm-bridge']:Kick(source, 'Exploiting detected.')
```

***

### 📦 Inventory Exports

Supported for: `ox_inventory`, `qb-inventory`, `qs-inventory`

***

#### `AddInventoryItem(id, item, count, metadata?)`

Adds item to a player’s inventory.

```lua
exports['devm-bridge']:AddInventoryItem(source, 'phone', 1, { serial = "XYZ-123" })
```

***

#### `RemoveInventoryItem(id, item, count, metadata?)`

Removes item from a player’s inventory.

```lua
exports['devm-bridge']:RemoveInventoryItem(source, 'usb', 1)
```

With metadata filtering:

```lua
exports['devm-bridge']:RemoveInventoryItem(source, 'usb', 1, { type = 'data' })
```

***

#### `GetInventoryItem(id, item)`

Returns **first matching** item or default `{ count = 0 }`.

```lua
local phone = exports['devm-bridge']:GetInventoryItem(source, 'phone')
print(phone.count)
```

***

#### `GetInventoryItems(id, item)`

Returns **all slots** of a matching item.

```lua
local allWaterBottles = exports['devm-bridge']:GetInventoryItems(source, 'water')
for _, bottle in pairs(allWaterBottles) do
    print(bottle.count, json.encode(bottle.metadata))
end
```

***

#### `SetItemMetadata(id, slot, metadata)`

Modifies metadata of a given item slot.\
Only works in `ox_inventory` and `qb-inventory`.

```lua
exports['devm-bridge']:SetItemMetadata(source, 4, {
    serial = "NEW-456",
    status = "used"
})
```

***

### 🔄 Notes

* `Framework` must be set to one of: `es_extended`, `qb-core`, `qbx_core`
* `Inventory` must be one of: `ox_inventory`, `qb-inventory`, `qs-inventory`
* `blackMoneyAsItem = true` will store black/dirty money as an inventory item (`Config.blackMoneyAsItem` name)
* All exports are internally adapted to each system’s format:
  * `amount` ➝ `count`
  * `info` ➝ `metadata`
  * `cash` vs `money`

```

Let me know if you want a `README.md` version auto-generated from this, or if you plan to add UI notifications or weapon metadata next!
```
