# Server

### Exports

<mark style="color:blue;">GetInsuredPlayers - Returns all insured players of the job</mark>

{% code fullWidth="false" %}

```lua
-- @param job: insurance job to get insured players from 
exports['gp_InsuranceSystem']:GetInsuredPlayers(job)

-- example usage
local Players = exports['gp_InsuranceSystem_ESX']:GetInsuredPlayers('ambulance')
for identifier,playerData in pairs(Players) do
    print("Identifier: " .. identifier ..
          "\nPlan: " .. playerData.plan .. 
          "\nPlayername: " .. playerData.playername ..
          "\nStartDate: " .. playerData.startDate ..
          "\nNextPaymentDate: " .. playerData.nextPaymentDate)
end
```

{% endcode %}

Variables for the playerData for each player:

| variable        | description                                   |
| --------------- | --------------------------------------------- |
| plan            | Plan name of the insurance/membership         |
| playername      | Name of the player                            |
| startDate       | Start date of the insurance/membership        |
| nextPaymentDate | Next payment date of the insurance/membership |

***

<mark style="color:blue;">GetPlanDetails - Returns the insurance/membership details of the player</mark>

{% hint style="warning" %}
You only need source or identifier! Input nil for the other parameter.
{% endhint %}

{% code fullWidth="false" %}

```lua
-- @param source: source of the player
-- @param identifier: identifier of the player (citizenid for QB)
-- @param insurance: insurance job
exports['gp_InsuranceSystem']:GetPlanDetails(source, identifier, insurance)
```

{% endcode %}

| variable        | description                    |
| --------------- | ------------------------------ |
| label           | Insurance/Membership plan name |
| coverage        | coverage of the plan           |
| price           | price of the plan              |
| paymentInterval | payment interval of the plan   |
| startingPrice   | startingprice of the plan      |
| cancelPrice     | cancelprice of the plan        |

***

<mark style="color:blue;">GetPrivateInsuranceCoverage - Returns the insurance/membership coverage of the player</mark>

{% hint style="warning" %}
You only need source or identifier! Input nil for the other parameter.
{% endhint %}

```lua
-- @param source: source of the player
-- @param identifier: identifier of the player (citizenid for QB)
-- @param insurance: insurance job
exports['gp_InsuranceSystem']:GetPrivateInsuranceCoverage(source, identifier, insurance)
```

***

<mark style="color:blue;">GetPlayerBusinessInsuranceCoverage</mark> \ <mark style="color:blue;">- Returns coverage of the players business insurance/membership</mark>

{% hint style="warning" %}
You only need source or identifier! Input nil for the other parameter.
{% endhint %}

```lua
-- @param source: source of the player
-- @param identifier: identifier of the player (citizenid for QB)
-- @param insurance: insurance job
exports['gp_InsuranceSystem']:GetPlayerBusinessInsuranceCoverage(source, identifier, insurance)
```

***

<mark style="color:blue;">GetBusinessInsuranceDetails - Returns insurance/membership contitions of the business</mark>

```lua
-- @param business: business name to get conditions
-- @param insurance: insurance job
exports['gp_InsuranceSystem']:GetBusinessInsuranceDetails(business, insurance)
```

| variable        | description       |
| --------------- | ----------------- |
| methode         | "fix" or "member" |
| coverage        | coverage          |
| price           | price             |
| paymentInterval | payment interval  |
| startingPrice   | startingprice     |
| cancelPrice     | cancelprice       |
