# 7 Data Structures

## 7.1 Resource Model

The full resource model is described in detail in the [API Specification](https://github.com/GovStackWorkingGroup/bb-workflow/blob/23Q4/api/swagger.yaml), but the following is a high-level diagram of the key entities.

![Diagram Source](/files/BDLlxQlMZfMcBECBXq38)

## 7.2 Data Elements

The data elements listed below provide detail for the resource model defined by the swagger specification. This section lists the required fields for each resource. The data elements listed are extensible in order to respond to specific use cases, however, the data elements listed below are a minimum requirement.

### 7.2.1 Process

**Description:** Represents a process that has been successfully created in a Workflow engine. This object contains important reference details like the generated process UUID (universally unique identifier), which is required to perform further operations on the process.

| Name              | Type                                          | Description                                 | Notes                                |
| ----------------- | --------------------------------------------- | ------------------------------------------- | ------------------------------------ |
| id                | integer                                       | generated by a system surrogate primary key | Required: false. Restrictions: none. |
| processDefinition | [ProcessDefinition](#7.2.2-processdefinition) | none                                        | Required: false. Restrictions: none. |

### 7.2.2 ProcessDefinition

**Description:** Reference to a blueprint of a process. Contains all the fields required to create a new process for a workflow engine.

| Name         | Type                                        | Description                                                                                              | Notes                                |
| ------------ | ------------------------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| name         | string                                      | name of a process                                                                                        | Required: true. Restrictions: none.  |
| type         | string                                      | none                                                                                                     | Required: true. Restrictions: none.  |
| version      | string                                      | none                                                                                                     | Required: true. Restrictions: none.  |
| isExecutable | boolean                                     | Specifies whether the Process is executable                                                              | Required: false. Restrictions: none. |
| isClosed     | boolean                                     | whether Messages and Events, not modeled in Process, can occur when the Process is executed or performed | Required: false. Restrictions: none. |
| description  | string                                      | none                                                                                                     | Required: false. Restrictions: none. |
| processBody  | [ListOfProperties](#7.2.5-listofproperties) | none                                                                                                     | Required: false. Restrictions: none. |

### 7.2.3 ProcessInstance

**Description:** Used to list a single or list of process instances that are in various states like active, suspended or stopped, in a Workflow engine.

| Name           | Type    | Description                                 | Notes                                |
| -------------- | ------- | ------------------------------------------- | ------------------------------------ |
| id             | integer | generated by a system surrogate primary key | Required: false. Restrictions: none. |
| processRef     | integer | reference to the process definition         | Required: false. Restrictions: none. |
| initTime       | string  | Initiation Timestamp                        | Required: false. Restrictions: none. |
| state          | string  | see BPMN specification v.2.0 section 13.2.2 | Required: false. Restrictions: none. |
| lastChangeTime | string  | last change Timestamp                       | Required: false. Restrictions: none. |

### 7.2.4 ProcessInstancePayload

**Description:** Initiates a process execution or creates a process instance. Contains the ability to capture input values that may be required to start a new process instance.

| Name             | Type                                        | Description | Notes                                |
| ---------------- | ------------------------------------------- | ----------- | ------------------------------------ |
| processStartedBy | string                                      | none        | Required: true. Restrictions: none.  |
| instanceValues   | [ListOfProperties](#7.2.5-listofproperties) | none        | Required: false. Restrictions: none. |

### 7.2.5 ListOfProperties

| Name  | Type   | Description | Notes                                |
| ----- | ------ | ----------- | ------------------------------------ |
| code  | string | none        | Required: false. Restrictions: none. |
| value | string | none        | Required: false. Restrictions: none. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://specs.govstack.global/workflow/7-data-structures.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
