# LeaseWorks

{% hint style="info" %}
The following documentation is for **LeaseWorks v1.2.2** *(BDK)*.
{% endhint %}

## Overview

LeaseWorks is a comprehensive lease management software solution for real estate and equipment leasing. This integration enables automated lease tracking, payment processing, and portfolio management workflows. Streamline lease administration and improve operational efficiency in lease management.

## Prerequisites

### 1. Required Books

The following Book(s) need to be added to your agent so it can learn and understand the automation procedures defined within them:

* **LeaseWorks**

#### How to Add the Book(s)

1. Go to **Books** → **All Books**.
2. Search for the name of the book and click on it.
3. Click on <kbd>**Install**</kbd> or <kbd>**Add Connection**</kbd> to add the book to your agent.
4. If adding a connection, you'll be prompted for [**connectivity**](#connectivity) details.

## Connectivity

This section outlines the available methods for connecting to the Book, along with the required configuration details for each.

### Connect using CLIENT ID, CLIENT SECRET and DOMAIN

Connect to Leaseworks API.

| Label         | Description                           | Type        |
| ------------- | ------------------------------------- | ----------- |
| CLIENT ID     | the client id                         | `text`      |
| CLIENT SECRET | the client secret                     | `sensitive` |
| DOMAIN        | the domain of the leaseworks instance | `text`      |

## Procedures

### to create a leaseworks monthend report

Create a monthend report.

Creates a monthend Report for a utilization and assembly parts

**Input Concepts**

| Concept                                       | Description                                    | Type                       | Required | Default Value |
| --------------------------------------------- | ---------------------------------------------- | -------------------------- | -------- | ------------- |
| [`utilization`](#leaseworks-utilization)      | the utilization for the monthend report        | `leaseworks utilization`   | No       | (no default)  |
| [`assembly parts`](#leaseworks-assembly-part) | the assembly parts used to generate the report | `leaseworks assembly part` | No       | (no default)  |

**Output Concepts**

| Concept                                 | Description        | Type                         |
| --------------------------------------- | ------------------ | ---------------------------- |
| [`answer`](#leaseworks-monthend-report) | A monthend report. | `leaseworks monthend report` |

**Examples**

Create a monthend report with the utilization

```generic
create a leaseworks monthend report
    the utilization is the utilization
```

Create a monthend report with the assembly parts

```generic
create a leaseworks monthend report
    the assembly parts are the assembly parts
```

### to create a utilization in leaseworks

Create an aircraft utilization in Leaseworks.

Creates an aircraft Utilization in Leaseworks.

**Input Concepts**

| Concept   | Description                            | Type                                  | Required | Default Value |
| --------- | -------------------------------------- | ------------------------------------- | -------- | ------------- |
| `payload` | the payload to include in the request. | \`\` or `file` or `list of` or `text` | Yes      | (no default)  |

**Output Concepts**

| Concept  | Description                   | Type   |
| -------- | ----------------------------- | ------ |
| `answer` | the response from the request | `json` |

**Examples**

Create a new utilization with the following details

```generic
create a json
use the above as the utilization json
set the utilization json's leaseworks__Aircraft__c to "a0A3w00000eyvGiEAI"
set the utilization json's leaseworks__Month_Ending__c to "2020-06-30"
set the utilization json's leaseworks__Type__c to "Actual"
set the utilization json's leaseworks__Status__c to "Open"
set the utilization json's leaseworks__Airframe_Flight_Hours_Month__c to "100"
set the utilization json's leaseworks__Airframe_Cycles_Landing_During_Month__c to "100"
create a utilization in leaseworks with
    the payload is the utilization json
```

### to retrieve some (aircrafts) from *leaseworks*

![FILTER - CAPABLE](https://img.shields.io/static/v1?label=FILTER\&message=CAPABLE\&color=blue)

Retrieve aircraft information from Leaseworks.

Retrieves Aircraft information from Leaseworks. It allows users to pass filters for the query.

**Output Concepts**

| Concept                             | Description       | Type                  |
| ----------------------------------- | ----------------- | --------------------- |
| [`aircrafts`](#leaseworks-aircraft) | List of aircrafts | `leaseworks aircraft` |

**Examples**

Get all aircrafts from leaseworks

```generic
retrieve some aircrafts from leaseworks
```

Retrieve aircrafts with filter

```generic
retrieve some aircraft from leaseworks whose name is "5198 (A320)"
```

Retrieve aircrafts with filter

```generic
retrieve some aircraft from leaseworks whose msn number is "6234"
```

### to retrieve some (assembly parts) from *leaseworks*

![FILTER - CAPABLE](https://img.shields.io/static/v1?label=FILTER\&message=CAPABLE\&color=blue)

Retrieve assembly parts for a utilization.

Retrieves assembly parts for a certain Utilization

**Input Concepts**

| Concept                                  | Description                           | Type                     | Required | Default Value |
| ---------------------------------------- | ------------------------------------- | ------------------------ | -------- | ------------- |
| [`utilization`](#leaseworks-utilization) | the utilization for the assembly part | `leaseworks utilization` | Yes      | (no default)  |

**Output Concepts**

| Concept                                       | Description            | Type                       |
| --------------------------------------------- | ---------------------- | -------------------------- |
| [`assembly parts`](#leaseworks-assembly-part) | List of assembly parts | `leaseworks assembly part` |

**Examples**

Get some assembly parts from leaseworks

```generic
retrieve some assembly parts from leaseworks
    the utilization is the utilization
```

## Concepts

### Leaseworks aircraft

Aircraft data model.A Aircraft Object

| Field Name       | Description                      | Type             |
| ---------------- | -------------------------------- | ---------------- |
| `id`             | the aircraft id                  | `text`           |
| `name`           | the aircraft name                | `optional[text]` |
| `msn_number`     | the custom leaseworks msn number | `optional[text]` |
| `type_attribute` | the type attribute               | `optional[text]` |
| `url`            | the url attribute                | `optional[text]` |

### Leaseworks utilization

Utilization data model.A Utilization Object

| Field Name | Description        | Type   |
| ---------- | ------------------ | ------ |
| `id`       | the utilization id | `text` |

### Leaseworks assembly part

Assembly Part data model.A Assembly Report Object

| Field Name                   | Description                                   | Type               |
| ---------------------------- | --------------------------------------------- | ------------------ |
| `id`                         | the aircraft id                               | `text`             |
| `name`                       | the aircraft name                             | `optional[text]`   |
| `type_attribute`             | the type attribute                            | `optional[text]`   |
| `url`                        | the url attribute                             | `optional[text]`   |
| `tsn_at_month_start_f`       | the tsn at month start                        | `optional[number]` |
| `running_hours_during_month` | the running hours during month                | `optional[number]` |
| `tsn_at_month_end`           | the tsn at month end                          | `optional[number]` |
| `csn_at_month_start_f`       | the csn at month start                        | `optional[number]` |
| `cycles_during_month`        | the cycles during month                       | `optional[number]` |
| `csn_at_month_end`           | the csn at month end                          | `optional[number]` |
| `serial_number`              | the serial number of the constituent assembly | `optional[text]`   |

### Leaseworks monthend report

MonthEnd report data model.A MonthEnd Report Object

| Field Name                                              | Description            | Type                                  |
| ------------------------------------------------------- | ---------------------- | ------------------------------------- |
| [`apu`](#leaseworks-report-section)                     | the apu                | `optional[leaseworks report section]` |
| [`engine1`](#leaseworks-report-section)                 | the first engine info  | `optional[leaseworks report section]` |
| [`engine2`](#leaseworks-report-section)                 | the second engine info | `optional[leaseworks report section]` |
| [`landing_gear_nose`](#leaseworks-report-section)       | the nose landing gear  | `optional[leaseworks report section]` |
| [`landing_gear_left_main`](#leaseworks-report-section)  | the left landing gear  | `optional[leaseworks report section]` |
| [`landing_gear_right_main`](#leaseworks-report-section) | the right landing gear | `optional[leaseworks report section]` |

### Leaseworks report section

Report section data model.A report section object

| Field Name   | Description                               | Type             |
| ------------ | ----------------------------------------- | ---------------- |
| `attributes` | a dictionary containing report attributes | `optional[json]` |
