# Incidents Message Structure

## Common Header

| Field       | Type          | Notes                             |
| ----------- | ------------- | --------------------------------- |
| MessageId   | string (GUID) | Unique per message; GUID/UUID v4  |
| Timestamp   | ISO-8601      | UTC                               |
| MessageType | int (enum)    | 1 = Fixture, 2 = LiveScore        |
| Fixtureid   | String        | Unique identifier for the fixture |
| Leagueid    | String        | Unique identifier for the League  |
| Sportid     | String        | Unique identifier for the sport   |

***

## LiveScore (Incidents)

**Example**

```json
{
  "header": {
    "MessageId": "0a5aa9bc-4c5c-4d0a-8f75-0b8f6f12c9a1",
    "Timestamp": "2025-11-04T19:55:25Z",
    "MessageType": 2
  },
  "body": {
    "status": null,
    "id": 777001,
    "fixtureId": 123456,
    "name": "Goal",
    "kind": "ScoreChange",
    "values": [
      { "position": 1, "value": "1" },
      { "position": 2, "value": "0" }
    ],
    "scoreType": 1,
    "initiatorPosition": 1,
    "seconds": 625,
    "playerList": [
      { "id": 501, "teamId": 9001, "name": "Bukayo Saka" }
    ],
    "period": { "id": 1, "name": "1st Half" },
    "confidence": 0.94
  }
}
```

***

## Fields

| Field             | Type                   | Required | Notes                                                                                                                                                                              |
| ----------------- | ---------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| fixtureId         | int                    | Yes      | Join to fixtures                                                                                                                                                                   |
| status            | string \| null         | No       | Score/Statistics → `'Empty'` / `'Cancelled'`; Period → `'Started'` / `'Finished'`; else `null`. `'Cancelled'` — if an incident has this status, it should be treated as cancelled. |
| id                | int                    | Yes      | Incident identifier                                                                                                                                                                |
| name              | string                 | Yes      | Incident label (e.g., Goal)                                                                                                                                                        |
| kind              | string                 | Yes      | Incident category                                                                                                                                                                  |
| values            | array\<Value> \| null  | No       | Keyed values (e.g., score per side)                                                                                                                                                |
| scoreType         | int \| null            | No       | Score semantics (if applicable)                                                                                                                                                    |
| initiatorPosition | int (enum) \| null     | No       | 1 = home, 2 = away                                                                                                                                                                 |
| seconds           | int \| null            | No       | Elapsed time from kickoff                                                                                                                                                          |
| period            | object                 | No       | period.id: int, period.name: string                                                                                                                                                |
| playerList        | array\<Player> \| null | No       | Optional list of players associated with the incident                                                                                                                              |
| confidence        | double (0.0–1.0)       | Yes      | Confidence grade (always present)                                                                                                                                                  |

***

## Value (object)

| Field    | Type       | Required | Notes                        |
| -------- | ---------- | -------- | ---------------------------- |
| position | int (enum) | No       | 1 = home, 2 = away           |
| value    | string     | No       | Value for the given position |

## Player (object)

| Field  | Type        | Required | Notes       |
| ------ | ----------- | -------- | ----------- |
| id     | int         | No       | Player id   |
| teamId | int \| null | No       | Team id     |
| name   | string      | No       | Player name |
