# API

## **Get a Job Account**

**`_API.JobAccount.Get(jobName)`**

Retrieves the shared job account for a given job.

* **Parameters:**
  * `jobName` *(string)* – The name of the job whose account is being retrieved.
* **Returns:**
  * `JobAccount` *(table)* – The job account object if found.
  * `nil` – If no account is found.
* **Example Usage:**

  ```lua
  local account = _API.JobAccount.Get("mechanic")
  if account then
      print("Account found:", account)
  else
      print("No job account exists for mechanic.")
  end
  ```

***

## **Get Job Account Balance**

**`_API.JobAccount.GetBalance(jobName)`**

Retrieves the balance of a shared job account.

* **Parameters:**
  * `jobName` *(string)* – The name of the job whose balance is being retrieved.
* **Returns:**
  * `balance` *(number)* – The current balance of the job account, or `0` if unavailable.
* **Example Usage:**

  ```lua
  local balance = _API.JobAccount.GetBalance("mechanic")
  print("Current balance:", balance)
  ```

***

## **Add Money to a Job Account**

**`_API.JobAccount.AddMoney(jobName, amount)`**

Adds money to a shared job account.

* **Parameters:**
  * `jobName` *(string)* – The name of the job whose account will receive money.
  * `amount` *(number)* – The amount of money to add.
* **Example Usage:**

  ```lua
  _API.JobAccount.AddMoney("mechanic", 5000)
  print("Added 5000 to mechanic account")
  ```

***

## **Remove Money from a Job Account**

**`_API.JobAccount.RemoveMoney(jobName, amount)`**

Removes money from a shared job account.

* **Parameters:**
  * `jobName` *(string)* – The name of the job whose account will be debited.
  * `amount` *(number)* – The amount of money to remove.
* **Example Usage:**

  ```lua
  _API.JobAccount.RemoveMoney("mechanic", 2000)
  print("Removed 2000 from mechanic account")
  ```

***

## **Set a Job Account Balance**

**`_API.JobAccount.SetMoney(jobName, amount)`**

Sets a specific balance for a shared job account.

* **Parameters:**
  * `jobName` *(string)* – The name of the job whose account balance will be set.
  * `amount` *(number)* – The new balance to be set for the job account.
* **Example Usage:**

  ```lua
  _API.JobAccount.SetMoney("mechanic", 10000)
  print("Set mechanic account balance to 10000")
  ```

***

## **Create a New Job Account**

**`_API.JobAccount.Create(jobName, startBalance)`**

Creates a new shared job account with a starting balance.

* **Parameters:**
  * `jobName` *(string)* – The name of the job/society for which the account will be created.
  * `startBalance` *(number)* – The initial balance of the newly created job account.
* **Returns:**
  * `true` – If the account was created successfully.
  * `false` – If the account could not be created.
* **Example Usage:**

  ```lua
  local success = _API.JobAccount.Create("mechanic", 5000)
  if success then
      print("Mechanic job account created successfully!")
  else
      print("Failed to create mechanic job account.")
  end
  ```
