# Exports

File: `shared/commands.lua`

The resource exposes several exports that can be called from **other resources** on both server and client sides.

## Server-side exports

### GetGardenerStats(source)

Returns the full stats object for a player.

```lua
local stats = exports['koja-lawnmower']:GetGardenerStats(playerSource)
```

Returns:

```lua
{
    level = { currentLevel, currentXP, maxXP },
    skillpoints = 0,
    skills = {},
    history = {
        logs = {},
        totalEarnings = 0,
        totalMissions = 0
    }
}
```

Returns `nil` if the player is not found.

### IsOnGardenerMission(source)

Checks whether a player is currently participating in any active gardener mission (as owner or party member).

```lua
local busy = exports['koja-lawnmower']:IsOnGardenerMission(playerSource)
-- returns: true | false
```

### GetGardenerParty(source)

Returns the party data for the player's current party, or `nil` if they are not in one.

```lua
local party = exports['koja-lawnmower']:GetGardenerParty(playerSource)
```

### StartGardenerMission(source, missionId)

Programmatically starts a mission for a player.

```lua
local success = exports['koja-lawnmower']:StartGardenerMission(playerSource, 'mirrorpark_1')
-- returns: true | false
```

## Client-side exports

All client exports internally call the server via callbacks and return the result synchronously (using `Citizen.Await`).

### GetGardenerStats()

```lua
local stats = exports['koja-lawnmower']:GetGardenerStats()
```

Same return format as the server version, but no `source` parameter needed.

### IsOnGardenerMission()

```lua
local busy = exports['koja-lawnmower']:IsOnGardenerMission()
-- returns: true | false
```

### GetGardenerParty()

```lua
local party = exports['koja-lawnmower']:GetGardenerParty()
```

### StartGardenerMission(missionId)

```lua
local success = exports['koja-lawnmower']:StartGardenerMission('mirrorpark_1')
-- returns: true | false
```

## Usage example

```lua
-- From another server script:
RegisterCommand('checkgardener', function(source)
    local stats = exports['koja-lawnmower']:GetGardenerStats(source)
    if stats then
        print(('Player level: %d, XP: %d/%d'):format(
            stats.level[1], stats.level[2], stats.level[3]
        ))
    end
end, false)
```
