# Accounts



<span id="accounts" />

This article provides an **overview of accounts** in the Socotra Insurance Suite.

Overview [#overview]

In the Socotra Insurance Suite, an **account** is a data object that represents a third-party entity (a person or a business) that is capable of being quoted for and being issued a policy for an insurance product. An account can also represent a payer or another external party.

Accounts associate individuals or businesses with the insurance products they’re covered by. Invoicing and payments can be managed at the account level.

A tenant's configuration defines the overall structure of accounts and how they must be configured, including which parameters are required or optional and which data types are permitted.

Configuring accounts [#configuring-accounts]

An important part of tenant configuration is defining what types of accounts you want to make available.

<Callout>
  Accounts are extensible with data in a similar way to other entities. For more information, see: [Data extensions](/configuration/data-extensions/overview).
</Callout>

The directory tree below shows an example of how the `accounts` directory of a tenant configuration could be set up to allow for multiple account types.

```
├── accounts
│   ├── BaseAccount
│   │   └── config.json
│   ├── CommercialAccount
│   │   └── config.json
│   └── ConsumerAccount
│       └── config.json
```

The example above shows three configured account types:

* `BaseAccount`
* `CommercialAccount`
* `ConsumerAccount`

Let's examine the differences between each of these accounts in their `config.json` files.

Example: BaseAccount [#example-baseaccount]

In the example below, the `BaseAccount` configuration is defined as a basis for all other accounts. We know this because its `abstract` parameter is set to `true`. The intent of this account is not to be used directly, but rather to be extended by other account definitions.

Notice that in the `CommercialAccount` and `ConsumerAccount` examples there is a property called `extend` that points to the BaseAccount. This means that those accounts also include the parameters defined in the BaseAccount.

```json
{
	"defaultSearchable": false,
	"data": {
		"tier": {
			"type": "string",
			"maxLength": 20000,
			"options": ["Gold", "Silver", "Bronze"],
			"searchable": true
		}
	},
	"abstract": true
}
```

Example: CommercialAccount [#example-commercialaccount]

In the example below, the `CommercialAccount` is configured specifically to meet the needs of a commercial insurance customer (as opposed to an individual consumer).

```json
{
	"extend": "BaseAccount",
	"numberingPlan": "numberingPlan2",
	"invoiceNumberingPlan": "numberingPlan3",
	"data": {
		"companyName": {
			"displayName": "Company Name",
			"type": "string",
			"maxLength": 20000
		}
	},
	"abstract": false
}
```

Example: ConsumerAccount [#example-consumeraccount]

In the example below, the `ConsumerAccount` is configured specifically to meet the needs of an individual consumer (as opposed to a commercial entity).

```json
{
	"displayName": "Personal",
	"extend": "BaseAccount",
	"numberingPlan": "numberingPlan2",
	"invoiceNumberingPlan": "numberingPlan3",
	"data": {
		"firstName": {
			"displayName": "First Name",
			"type": "string",
			"maxLength": 20000,
			"searchable": true
		},
		"middleName": {
			"displayName": "Middle Name",
			"type": "string?",
			"maxLength": 20000,
			"searchable": false
		},
		"lastName": {
			"displayName": "Last Name",
			"type": "string",
			"minLength": 2,
			"maxLength": 20000,
			"searchable": true
		}
	},
	"abstract": false
}
```

Account states [#account-states]

An account can exist in one of two states. The table below list the two states and whether they can be used to validate [quotes](/features/policy-quotation/quotes) and/or [quick quotes](/features/policy-quotation/quick-quotes).

| Account state | Description                                                                                                                                                                                                                                                                                                                                                                 | Can quote? | Can quick quote? |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ---------------- |
| `draft`       | A `draft` account is mutable without restriction.                                                                                                                                                                                                                                                                                                                           | No         | Yes              |
| `validated`   | A `validated` account is an account that's been validated according to the tenant configuration and any other custom validation rules. Once an account is validated, it can't revert to a `draft` state. It's possible to update an account, but the updates must also be validated according to the tenant configuration. If validation fails, the changes won't be saved. | Yes        | Yes              |

Limiting products to certain account types [#limiting-products-to-certain-account-types]

On an insurance product, the `eligibleAccountTypes` property can be configured to restrict its usage to certain account types.

For example, an insurance product intended only for individual consumers could be limited to a `ConsumerAccount`.

<Callout>
  If the `eligibleAccountTypes` for an insurance product is left unspecified, all account types are considered eligible for the product.
</Callout>

Extension data [#extension-data]

Accounts are extensible with data in a similar way to other entities. See the [Data Extensions](/configuration/data-extensions/overview) topic for more details.

See also [#see-also]

* [Account API](/api/accounts)
