# Indigitall Cordova SDK — Main Models

This document describes the main models of the Indigitall Cordova SDK, their properties and relationships.

---

## Table of Contents

1. [Device](#device)
2. [Push](#push)
3. [Inbox](#inbox)
4. [Inbox MessagesCount](#inbox-messagescount)
5. [Customer](#customer)
6. [LiveActivity](#liveactivity)
7. [Topic](#topic)
8. [InApp](#inapp)

---

## Device

Represents the device registered in the Indigitall platform. Contains hardware, OS, app and push token information used for device registration and targeting.

| Property | Type | Description |
|----------|------|-------------|
| `enable` | `Boolean` | Whether push notifications are enabled on the device |
| `deviceId` | `String` | Unique device identifier assigned by Indigitall |
| `pushToken` | `String` | FCM (Android) or APNs (iOS) registration token used to deliver push notifications |
| `platform` | `String` | Platform identifier. Values: `android`, `ios` |
| `version` | `String` | Indigitall SDK version (e.g. `6.0.1`) |
| `productName` | `String` | Cordova product name (e.g. `cordova`) |
| `productVersion` | `String` | Plugin version (e.g. `5.1.0`) |
| `osName` | `String` | Operating system name (e.g. `Android`, `iOS`) |
| `osVersion` | `String` | OS version (e.g. `14`) |
| `deviceBrand` | `String` | Device manufacturer (e.g. `Samsung`) |
| `deviceModel` | `String` | Device model name (e.g. `Galaxy S24`) |
| `operator` | `String` | Mobile network operator name |
| `deviceType` | `String` | Form factor of the device. Values: `mobile`, `tablet` |
| `appVersion` | `String` | Version of the host application (e.g. `2.1.0`) |
| `locale` | `String` | BCP 47 locale code (e.g. `es_ES`) |
| `timeZone` | `String` | IANA time zone identifier (e.g. `Europe/Madrid`) |
| `timeOffset` | `Int` | UTC offset in minutes (e.g. `120`) |
| `externalCode` | `String` | External user identifier set by the integrator |
| `externalApps` | `Array<ExternalApp>` | List of external applications linked to this device |

### Related model: `ExternalApp`

| Property | Type | Description |
|----------|------|-------------|
| `id` | `String` | External app internal identifier |
| `name` | `String` | External app name |
| `code` | `String` | External app Android code |

---

## Push

Represents a push notification received from the Indigitall platform.

| Property | Type | Description |
|----------|------|-------------|
| `id` | `String` | Internal push notification identifier |
| `appKey` | `String` | Indigitall application key |
| `title` | `String` | Notification title shown to the user |
| `body` | `String` | Notification body text |
| `icon` | `String` | URL of the notification icon |
| `image` | `String` | URL of the large image attached to the notification |
| `gif` | `String` | URL of an animated GIF, if any |
| `layout` | `String` | Notification layout template identifier |
| `data` | `String` | Arbitrary string payload defined in the campaign |
| `silent` | `Boolean` | If `true`, the notification does not display a heads-up alert |
| `securedData` | `String` | Encrypted payload, if secure delivery is enabled |
| `sendingId` | `String` | Identifier of the specific sending batch |
| `campaignId` | `String` | Identifier of the campaign this push belongs to |
| `pushId` | `String` | Push notification identifier (same as `id`) |
| `applicationId` | `String` | Indigitall application identifier |
| `sendEventAck` | `Boolean` | If `true`, an acknowledgement event must be sent back to the server |
| `action` | `PushAction` | Action to execute when the user taps the notification |
| `buttons` | `Array<PushButton>` | Action buttons displayed in the expanded notification |

### Related models

**`PushAction`** — Defines the action executed when the notification or a button is tapped.

| Property | Type | Description |
|----------|------|-------------|
| `destroy` | `Boolean` | If `true`, the notification is dismissed after the action executes |
| `type` | `String` | Action type. Values: `url`, `app`, `call`, `market`, `share`, `noAction` |
| `url` | `String` | Target URL to open in the browser |
| `app` | `String` | Deep-link URI to open in another app |
| `call` | `String` | Phone number to dial |
| `market` | `String` | App store identifier to open |
| `share` | `String` | Text content to share |
| `topics` | `Array<String>` | Topic codes to subscribe/unsubscribe when the action executes |
| `clickedButton` | `Int` | 0-based index of the button pressed. `-1` if the main notification body was tapped |

**`PushButton`** — Action button displayed in an expanded push notification.

| Property | Type | Description |
|----------|------|-------------|
| `label` | `String` | Button display text |
| `action` | `PushAction` | Action to execute when the button is tapped |
| `topics` | `Array<String>` | Topic codes associated with this button |

---

## Inbox

Represents the user's notification inbox (message center), including pagination state and the list of stored notifications.

| Property | Type | Description |
|----------|------|-------------|
| `lastAccess` | `String` | ISO 8601 timestamp of the last time the inbox was opened |
| `count` | `Int` | Total number of notifications stored in the inbox |
| `pageSize` | `Int` | Number of notifications per page |
| `numPage` | `Int` | Current page index (0-based) |
| `notifications` | `Array<InboxNotification>` | List of all notifications in the current page |
| `newNotifications` | `Array<InboxNotification>` | Only the new notifications since the last sync (same structure as `notifications`) |

### Related models

**`InboxNotification`** — A single notification entry stored in the inbox.

| Property | Type | Description |
|----------|------|-------------|
| `id` | `String` | Unique inbox notification identifier |
| `sentAt` | `String` | ISO 8601 timestamp of when the notification was sent |
| `status` | `String` | Interaction status. Values: `read`, `unread`, `deleted` |
| `sendingId` | `String` | Identifier of the sending batch |
| `campaignId` | `String` | Identifier of the originating campaign |
| `category` | `InboxCategory` | Category this notification belongs to |
| `message` | `InboxMessage` | Content of the notification |

**`InboxCategory`** — Category used to group and filter inbox notifications.

| Property | Type | Description |
|----------|------|-------------|
| `id` | `Int` | Category numeric identifier |
| `code` | `String` | Category short code (e.g. `promo`) |
| `name` | `String` | Category display name (e.g. `Promotions`) |

**`InboxMessage`** — Notification content stored in the inbox.

| Property | Type | Description |
|----------|------|-------------|
| `title` | `String` | Notification title |
| `body` | `String` | Notification body text |
| `image` | `String` | URL of the notification image |
| `data` | `String` | Arbitrary string payload |
| `securedData` | `String` | Encrypted payload, if any |
| `action` | `PushAction` | Action to execute when the notification is tapped |
| `buttons` | `Array<PushButton>` | Action buttons for the inbox notification |

---

## Inbox MessagesCount

Represents the statistical counters for the user's inbox.

| Property | Type | Description |
|----------|------|-------------|
| `click` | `Int` | Total number of notifications clicked by the user |
| `sent` | `Int` | Total number of notifications delivered to the inbox |
| `deleted` | `Int` | Total number of notifications deleted by the user |
| `lastAccess` | `String` | ISO 8601 timestamp of the last inbox access |
| `count` | `Int` | Number of unread notifications since `lastAccess` |

---

## Customer

Represents a customer/user profile registered in the Indigitall platform. Used to link a device to a specific user identity.

| Property | Type | Description |
|----------|------|-------------|
| `id` | `String` | Indigitall internal customer record identifier |
| `customerId` | `String` | External user identifier provided by the integrator |
| `applicationId` | `String` | Indigitall application identifier |
| `createdAt` | `String` | ISO 8601 timestamp of when the customer record was created |
| `updatedAt` | `String` | ISO 8601 timestamp of the last update to the customer record |

---

## LiveActivity

Represents a Live Activity session registered in the Indigitall platform. On Android it uses FCM dynamic topics; on iOS it uses APNs Live Activity channels.

| Property | Type | Description |
|----------|------|-------------|
| `laId` | `String` | Unique Live Activity identifier |
| `createdAt` | `String` | ISO 8601 timestamp of when the Live Activity was created |
| `updatedAt` | `String` | ISO 8601 timestamp of the last status update |
| `applicationId` | `String` | Indigitall application identifier |
| `liveActivityExternalId` | `String` | External identifier set by the integrator to link this activity |
| `status` | `String` | Current state. Values: `active`, `dismissed`, `ended` |
| `androidTopicId` | `String` | FCM topic used to push updates to this Live Activity on Android |

---

## Topic

Represents a push notification topic (category) that a device can subscribe to or unsubscribe from. Used to segment users by areas of interest.

| Property | Type | Description |
|----------|------|-------------|
| `code` | `String` | Unique topic identifier used in API calls (e.g. `news`) |
| `name` | `String` | Human-readable topic name shown to users (e.g. `News`) |
| `visible` | `Boolean` | If `true`, the topic is displayed in the topic list UI |
| `subscribed` | `Boolean` | Whether the current device is subscribed to this topic |
| `parentCode` | `String` | Code of the parent topic for hierarchical grouping. `null` if top-level |

---

## InApp

Represents an in-app message served by the Indigitall platform. Contains display configuration, content URL, show rules, and custom data.

| Property | Type | Description |
|----------|------|-------------|
| `inAppId` | `String` | Unique in-app message identifier |
| `lastVersionId` | `String` | Identifier of the latest content version |
| `showOnce` | `Boolean` | If `true`, the message is displayed only once per device |
| `cacheTtl` | `Int` | Seconds the in-app content is valid in local cache |
| `creationDate` | `String` | ISO 8601 creation timestamp |
| `expiredDate` | `String` | ISO 8601 expiry timestamp after which the message is no longer shown |
| `version` | `Int` | Content version number |
| `name` | `String` | Human-readable name of the in-app campaign |
| `customData` | `Object` | Arbitrary custom key-value pairs defined in the campaign |
| `schema` | `InAppSchema` | Display template and dimensions |
| `properties` | `InAppProperties` | Visual and behavioral configuration of the in-app |
| `inAppShow` | `InAppShow` | Runtime display counters and dismissal state |

### Related models

**`InAppSchema`** — Template and size definition for the in-app container.

| Property | Type | Description |
|----------|------|-------------|
| `code` | `String` | Template code. Values: `MODAL`, `BANNER`, `FULLSCREEN` |
| `width` | `Int` | Display width in dp |
| `height` | `Int` | Display height in dp |

**`InAppProperties`** — Visual and behavioral configuration of the in-app message.

| Property | Type | Description |
|----------|------|-------------|
| `contentUrl` | `String` | URL of the HTML/web content to render inside the in-app |
| `showTime` | `Int` | Milliseconds before the in-app auto-dismisses. `0` = no auto-dismiss |
| `numberOfShows` | `Int` | Maximum number of times the message can be shown |
| `numberOfClicks` | `Int` | Maximum number of times the message can be clicked |
| `dismissForever` | `Boolean` | If `true`, dismissing the message prevents it from ever showing again |
| `borderRadius` | `Int` | Corner radius in dp for the in-app container |
| `action` | `InAppAction` | Action to execute when the user interacts with the in-app |

**`InAppAction`** — Action executed when the in-app is tapped.

| Property | Type | Description |
|----------|------|-------------|
| `destroy` | `Boolean` | If `true`, the in-app is dismissed after the action executes |
| `type` | `String` | Action type. Values: `url`, `app`, `call`, `market`, `share` |
| `url` | `String` | Target URL to open |
| `topics` | `Array<String>` | Topic codes to subscribe/unsubscribe when the action executes |

**`InAppShow`** — Runtime counters tracking how the message has been interacted with.

| Property | Type | Description |
|----------|------|-------------|
| `timesShowed` | `Int` | Number of times the message has been displayed so far |
| `timesClicked` | `Int` | Number of times the message has been clicked so far |
| `wasDismissed` | `Boolean` | `true` if the user explicitly dismissed the message |

---

## Relationships

```
Push
 ├── PushAction
 │    └── type {url, app, call, market, share, noAction}
 └── PushButton[]
      └── PushAction

Device
 └── ExternalApp[]

Inbox
 └── InboxNotification[]
      ├── InboxMessage
      │    ├── PushAction
      │    └── PushButton[]
      └── InboxCategory

InboxMessagesCount

Customer

LiveActivity

Topic

InApp
 ├── InAppSchema
 ├── InAppProperties
 │    └── InAppAction
 └── InAppShow
```
