> ## Documentation Index
> Fetch the complete documentation index at: https://docs.megaworks.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Server-Side Adapter

## Methods (V2)

Server adapters bridge Doctorjob to your framework (character data, permissions, money, inventory/usable items) and handle DB initialization.

Most of the methods below are required for normal functionality. Some are optional (called out explicitly).

`InitializeDB()`

* Creates the required tables if they don't exist
* Ensures required default records exist (for example, a default hospital)

`ResurrectPlayer(targetID)`

* targetID (number) dynamic ID of RedM

`GetCharJob(targetID)`

* targetID (number) dynamic ID of RedM
* **Returns**: a *string* containing the job name

`GetCharIdentifier(targetID)`

* targetID (number) dynamic ID of RedM
* **Returns**: a *string* or *number* containing the character identifier

`GetCharFirstname(targetID)`

* targetID (number) dynamic ID of RedM
* **Returns**: a *string* containing the char firstname

`GetCharLastname(targetID)`

* targetID (number) dynamic ID of RedM
* **Returns**: a *string* containing the char lastname

`GetCharMoney(targetID)`

* targetID (number) dynamic ID of RedM
* **Returns**: a *number* containing the amount of the char's money

`RemoveCurrency(targetID, currency, amount)`

* targetID (number) dynamic ID of RedM
* currency (number|string) ID of the currency to remove (framework-specific; ignore if unused)
* amount (number) the amount of money to be taken

`GetCharGroup(targetID)`

* targetID (number) dynamic ID of RedM
* **Returns**: a *string* containing the char group (ex. VORP could have 'admin', 'user'...). It's needed to identify whether the user is an admin or not.

`RegisterUsableItems()`

* Registers all Doctorjob usable items with your framework
* Must include vaccine items from `Config.vaccines.items`

`RemoveItem(targetID, itemId, amount)`

* targetID (number) dynamic ID of RedM
* itemId (string) item name/id in your inventory system
* amount (number)

`GetPatientNotes(patientIdentifier)`

* patientIdentifier (string|number) persistent character identifier

<Info>
  `patientIdentifier` should match what your adapter returns from `GetCharIdentifier()`.
</Info>

## Optional methods

`GetInventoryItems(targetID)`

* targetID (number) dynamic ID of RedM
* **Returns**: a list of inventory items (framework-dependent)
