# Viewpoints

> Use one reinsurer's Lines for towers, placements, recovery Estimates and comparisons.

The default `whole` viewpoint uses all known Lines from a cedant or broker. Send `viewpoint: { "kind": "reinsurer", "reinsurer": "Example Re" }` when the caller has its own Lines. The private Program mirrors use the saved Program's viewpoint. The comparison mirror uses the saved Base Program's viewpoint for every version.

| Operation | Reinsurer viewpoint |
| --- | --- |
| `/towers` | Draws Our Lines, Other reinsurers and the cedant. |
| `/placements` | Reports Our Lines and `ourShareOfWhole`. |
| `/recoveries` | Estimates `ourShare` from the 100% Layer recovery. |
| `/comparisons` | Compares Layers carrying Our Lines and can replay Losses for Our share. |

## Our share

Send the Order on each Layer and match the `reinsurer` string on your Lines exactly. The Engine keeps every matching Line except `declined` Lines and includes `indication` and `quoted` Lines with their original status. It uses a supplied `signedShare` under either signing rule and falls back to `writtenShare`. With either signing rule, a firm Line may omit its `signedShare`. It converts shares on an `of order` basis by multiplying by Order / 100. Shares on an `of whole` basis are already percentages of the whole Layer.

## Towers

Each Layer slot is split left to right into a `line` block per matching Line, an `otherReinsurers` block for the Order less Our share (at least zero), and a `cedant` block for the share outside both the Order and Our Lines. The anonymous block has null `reinsurer` and `lineStatus`. Cedant blocks and retention fillers use `isRetention: true` and `blockKind: 'cedant'`. Zero-width blocks are omitted. If Our Lines exceed 100% of the whole Layer, their widths scale proportionally to fit the slot and their reported shares retain the supplied values.

A Layer with no matching Lines draws the Order as Other reinsurers and the rest as cedant. A Layer with no Order draws entirely as cedant within its slot. The same split applies to proportional and XOL Layers, including surplus bands. The whole viewpoint omits `blockKind`.

`@vinsa/towers` 0.3.0 draws reinsurer-viewpoint charts. Install 0.3.1 or later to select a Layer by clicking its cedant share, including when the Layer has no Order.

In this two-Layer example, separate from the worked example below, Example Re has a firm order Line of 40% of an 80% Order on the Working XL and a quoted 30% on the Upper XL. Quoted and indication Lines draw with a dashed outline.

## Placements

The response includes only matching, non-declined Lines. Each Line reports its `status`, `writtenShare`, `writtenShareOfWhole`, supplied `signedShare` (or null), and `signedShareOfWhole`. The Layer echoes its `order` (null when missing) and resolved `lineBasis`. Its `ourShareOfWhole` sums the shares used to draw Our Lines. Without an Order, `ourShareOfWhole`, `writtenShareOfWhole` and `signedShareOfWhole` are all null. The whole viewpoint omits `ourShareOfWhole`.

| Scope | Fields returned as null |
| --- | --- |
| Line | `signingFactor` |
| Layer | `firmTotal`, `support`, `placedOfOrder`, `placedOfWhole`, `gap`, `oversubscription`, `status`, `amountPlaced` |
| Contract and Program | `amountPlaced`, `layerCountByStatus` |

One `viewpoint-layer-facts-unavailable` limitation at `viewpoint` covers all of those fields.

## Recoveries

The Engine applies inuring, Events, annual terms and opening positions at 100% of each Layer. It estimates `ourShare` as `toLayer × ourShareOfWhole / 100` for each Loss Layer and Layer year. The share is null without an Order and zero when the Order is known and the Layer has none of Our Lines. The response totals Our share by effective Layer currency. The Engine reports reinstatement premium at 100% and at Our share of whole. The XOL premium share follows the same Order and Our Lines rules as Recovery. Proportional Layers report zero premium for Our share. All recovery and reinstatement premium amounts are Estimates for illustration and what-if analysis. Never use them for booking. See [Estimate recoveries](https://towers.vinsa.dev/docs/api/recoveries.md).

## Comparisons

The Engine matches all Layers, then reports only results involving Our non-declined Lines. When we participate on one side of a match, that Layer appears as `added` or `removed`. When we participate on both sides, the match reports changes to Our Lines and `ourShareOfWhole`, with `status: null`. Contract pricing and coverage use only Layers carrying Our non-declined Lines. Pricing uses the 100% Layer figures. Loss replay applies the full Program in each version and reports Our share Estimates by currency. See [Compare Programs](https://towers.vinsa.dev/docs/api/comparisons.md).

## Warnings

| Code | Request path | Meaning |
| --- | --- | --- |
| `viewpoint-other-line` | Line | The Engine ignored a Line for a different reinsurer. One warning per such Line. |
| `viewpoint-order-missing` | Layer | The Engine needs a stated Order to derive shares of whole. |
| `viewpoint-line-exceeds-order` | Layer | Our shares of whole total more than the Order. The Engine preserves the Line shares and allocates zero to Other reinsurers. |

## Worked example

This request works with `/towers` and `/placements`. A written 20% of an 80% Order gives Example Re 16% of the whole Layer. Other reinsurers account for 64% and the cedant accounts for 20%.

```json title="viewpoints-request.json"
{
  "viewpoint": {
    "kind": "reinsurer",
    "reinsurer": "Example Re"
  },
  "program": {
    "contracts": [
      {
        "contractRef": "working-xl",
        "currency": "USD",
        "layers": [
          {
            "layerRef": "working",
            "layerName": "Working XL",
            "layerType": "XOL",
            "accumulateBasis": "CLM",
            "lowerLimit": 0,
            "upperLimit": 1000000,
            "isUnlimited": false,
            "order": 80,
            "lineBasis": "of order",
            "lines": [
              {
                "reinsurer": "Example Re",
                "status": "firm order",
                "writtenShare": 20
              }
            ]
          }
        ]
      }
    ],
    "risks": [
      {
        "riskId": "property",
        "contractRefs": [
          "working-xl"
        ]
      }
    ]
  }
}
```

### Towers response

```json title="viewpoints-towers-response.json"
{
  "risks": [
    {
      "riskId": "property",
      "policyRef": null,
      "insuredName": null,
      "towers": [
        {
          "towerNo": 1,
          "towerName": "Tower",
          "bands": [
            {
              "hBandNo": 1,
              "hyFrom": 0,
              "hyTo": 1000000,
              "bandRange": "$0 – $1M",
              "isUnlimited": false,
              "verticalBlocks": [
                {
                  "vBlockNo": 0,
                  "layerRef": "working",
                  "layerName": "Working XL",
                  "layerType": "XOL",
                  "contractRef": "working-xl",
                  "sharedRiskCount": 1,
                  "lowerLimit": 0,
                  "upperLimit": 1000000,
                  "layerAmount": 1000000,
                  "share": 16,
                  "participationShare": null,
                  "retainedShare": null,
                  "order": 80,
                  "cededShare": 80,
                  "currency": "USD",
                  "accumulateBasis": "CLM",
                  "protection": null,
                  "aad": null,
                  "reinsurer": "Example Re",
                  "lineStatus": "firm order",
                  "isRetention": false,
                  "colorKey": "working-xl",
                  "colorOverride": null,
                  "color": "#14b8a6",
                  "xSpan": [
                    0,
                    0.16
                  ],
                  "ySpan": [
                    0,
                    1
                  ],
                  "isPrimary": true,
                  "overlapId": null,
                  "blockKind": "line",
                  "label": "Example Re",
                  "normalizedShare": 16
                },
                {
                  "vBlockNo": 1,
                  "layerRef": "working",
                  "layerName": "Working XL",
                  "layerType": "XOL",
                  "contractRef": "working-xl",
                  "sharedRiskCount": 1,
                  "lowerLimit": 0,
                  "upperLimit": 1000000,
                  "layerAmount": 1000000,
                  "share": 64,
                  "participationShare": null,
                  "retainedShare": null,
                  "order": 80,
                  "cededShare": 80,
                  "currency": "USD",
                  "accumulateBasis": "CLM",
                  "protection": null,
                  "aad": null,
                  "reinsurer": null,
                  "lineStatus": null,
                  "isRetention": false,
                  "colorKey": "working-xl",
                  "colorOverride": null,
                  "color": "#14b8a6",
                  "xSpan": [
                    0.16,
                    0.8
                  ],
                  "ySpan": [
                    0,
                    1
                  ],
                  "isPrimary": true,
                  "overlapId": null,
                  "blockKind": "otherReinsurers",
                  "label": "Other reinsurers",
                  "normalizedShare": 64
                },
                {
                  "vBlockNo": 2,
                  "layerRef": "working",
                  "layerName": "Working XL",
                  "layerType": "XOL",
                  "contractRef": "working-xl",
                  "sharedRiskCount": 1,
                  "lowerLimit": 0,
                  "upperLimit": 1000000,
                  "layerAmount": 1000000,
                  "share": 20,
                  "participationShare": null,
                  "retainedShare": null,
                  "order": 80,
                  "cededShare": 0,
                  "currency": "USD",
                  "accumulateBasis": "CLM",
                  "protection": null,
                  "aad": null,
                  "reinsurer": null,
                  "lineStatus": null,
                  "isRetention": true,
                  "colorKey": "retention",
                  "colorOverride": null,
                  "color": "#94a3b8",
                  "xSpan": [
                    0.8,
                    1
                  ],
                  "ySpan": [
                    0,
                    1
                  ],
                  "isPrimary": true,
                  "overlapId": null,
                  "blockKind": "cedant",
                  "label": "Retention",
                  "normalizedShare": 20
                }
              ]
            }
          ],
          "unlimitedBands": []
        }
      ]
    }
  ],
  "warnings": [],
  "limitations": [],
  "unlimitedDisplayHeight": 1000000
}
```

### Placements response

```json title="viewpoints-placements-response.json"
{
  "program": {
    "amountPlaced": null,
    "layerCountByStatus": null
  },
  "contracts": [
    {
      "contractRef": "working-xl",
      "stage": null,
      "amountPlaced": null,
      "layerCountByStatus": null,
      "layers": [
        {
          "layerRef": "working",
          "layerName": "Working XL",
          "lineBasis": "of order",
          "currency": "USD",
          "firmTotal": null,
          "support": null,
          "placedOfOrder": null,
          "placedOfWhole": null,
          "gap": null,
          "oversubscription": null,
          "status": null,
          "amountPlaced": null,
          "order": 80,
          "lines": [
            {
              "reinsurer": "Example Re",
              "status": "firm order",
              "writtenShare": 20,
              "signedShare": null,
              "writtenShareOfWhole": 16,
              "signedShareOfWhole": null,
              "signingFactor": null
            }
          ],
          "ourShareOfWhole": 16,
          "warnings": []
        }
      ]
    }
  ],
  "warnings": [],
  "limitations": [
    {
      "code": "viewpoint-layer-facts-unavailable",
      "message": "The reinsurer viewpoint cannot derive Layer firmTotal, support, placedOfOrder, placedOfWhole, gap, oversubscription, status or amountPlaced, Line signingFactor, or Contract and Program amountPlaced and layerCountByStatus.",
      "path": "viewpoint"
    }
  ]
}
```
