# References (iOS)

## ChallengesSyncStatus

| Value                           | Description                                                                      |
| ------------------------------- | -------------------------------------------------------------------------------- |
| success                         | Synchronization has been successfully performed.                                 |
| cacheDataOnly                   | SynchronizationType has been set to `.cache`.                                    |
| failedToSyncChallengesCacheOnly | Synchronization has failed, only challenges previously synchronized are returned |
| syncAlreadyInProgress           | Another challenge list synchronization is already in progress                    |

## DKChallenge

| Field                 | Type                                     | Description                                                                                                                                                                                                        |
| --------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| id                    | String                                   | Unique identifier of the challenge                                                                                                                                                                                 |
| title                 | String                                   | Title of the challenge                                                                                                                                                                                             |
| challengeDescription  | String                                   | Description of the challenge                                                                                                                                                                                       |
| conditionsDescription | String?                                  | Description of the challenge’s conditions to be filled.                                                                                                                                                            |
| startDate             | Date                                     | Challenge’s start date                                                                                                                                                                                             |
| endDate               | Date                                     | Challenge’s end date                                                                                                                                                                                               |
| conditions            | \[String, Any]                           | <p>Required conditions to participate. </p><p>Possible keys of the dictionary are: <code>km</code> and <code>nbTrip</code>.</p><p><strong>Remark:</strong> All conditions must be met in order to participate.</p> |
| rankKey               | String?                                  | *Deprecated*.                                                                                                                                                                                                      |
| themeCode             | Int                                      | *Deprecated.*                                                                                                                                                                                                      |
| type                  | Int                                      | *Deprecated.*                                                                                                                                                                                                      |
| isRegistered          | Bool                                     | Equals `true` if the user participates in the challenge.                                                                                                                                                           |
| conditionsFilled      | Bool                                     | Equals `true` if the conditions are filled by the user to access the challenge.                                                                                                                                    |
| driverConditions      | \[String, Any]                           | <p>Current driver values for conditions to participate in the challenge.</p><p>Possible keys of the dictionary are: <code>km</code> and <code>nbTrip</code></p>                                                    |
| groups                | \[[DKChallengeGroup](#dkchallengegroup)] | Groups that can view and participate to the challenge                                                                                                                                                              |
| rules                 | String?                                  | Rules of the current challenge                                                                                                                                                                                     |
| optinText             | String?                                  | Opt-in text of the current challenge                                                                                                                                                                               |
| status                | [DKChallengeStatus](#dkchallengestatus)  | Current status of the challenge                                                                                                                                                                                    |
| nbDriverRegistered    | Int                                      | Number of drivers registered for this challenge                                                                                                                                                                    |
| nbDriverRanked        | Int                                      | Number of drivers ranked for this challenge                                                                                                                                                                        |
| rank                  | Int                                      | <p>Current rank of the driver.<br>Equals <code>0</code> if the driver is not registered or not ranked for this challenge.</p>                                                                                      |

## Theme code

<table><thead><tr><th width="100">Value</th><th>Description</th></tr></thead><tbody><tr><td>101</td><td>Challenge based on eco driving score</td></tr><tr><td>201</td><td>Challenge based on safety score</td></tr><tr><td>205</td><td>Challenge based on the number of hard brakings</td></tr><tr><td>209</td><td>Challenge based on the number of hard acceleration</td></tr><tr><td>221</td><td>Challenge based on distraction score</td></tr><tr><td>401</td><td>Challenge based on speeding score</td></tr></tbody></table>

## DKChallengeGroup

| Field | Type   | Description        |
| ----- | ------ | ------------------ |
| id    | String | Group identifier   |
| label | String | Label of the group |

## DKChallengeStatus

<table><thead><tr><th width="188">Value</th><th>Description</th></tr></thead><tbody><tr><td>finished</td><td>The challenge is finished.</td></tr><tr><td>scheduled</td><td>The challenge has not started yet.</td></tr><tr><td>pending</td><td>The challenge is in progress.</td></tr><tr><td>archived</td><td>The challenge is finished and is archived. It should not appear in the list</td></tr><tr><td>draft</td><td><em>Internal status. Should not happen.</em></td></tr><tr><td>undefined</td><td><em>Internal status. Should not happen.</em></td></tr></tbody></table>

## ChallengeDetailSyncStatus

| Value                          | Description                                                                            |
| ------------------------------ | -------------------------------------------------------------------------------------- |
| success                        | Synchronisation has been successfully performed.                                       |
| notFound                       | There is no existing challenge with this *challengeId*.                                |
| cacheDataOnly                  | *synchronizationType* has been set to `.cache`.                                        |
| failedToSyncChallengeCacheOnly | Synchronisation has failed, only challenge detail previously synchronized is returned. |
| syncAlreadyInProgress          | Another challenge detail retrieval for this identifier is already in progress          |

## DKChallengeDetail

| Field              | Type                                  | Description                                                      |
| ------------------ | ------------------------------------- | ---------------------------------------------------------------- |
| challengeId        | String                                | Identifier of the challenge                                      |
| driverStats        | [DKDriverStats](#dkdriverstats)       | Driver’s statistics of the challenge                             |
| challengeStats     | [DKChallengeStats](#dkchallengestats) | Global statistics of the challenge                               |
| driverRanked       | \[[DKDriverRanked](#dkdriverranked)]  | Ranked drivers list.                                             |
| userIndex          | Int                                   | Position of the user in the `driverRanked` list                  |
| nbDriverRegistered | Int                                   | Number of drivers registered for this challenge                  |
| nbDriverRanked     | Int                                   | Number of drivers ranked for this challenge                      |
| isRegistered       | Bool                                  | Equals `true` if the user is registered to the challenge         |
| conditionsFilled   | Bool                                  | Equals `true` if the user has filled the condition to be ranked. |
| itinIds            | \[String]                             | List of itinerary IDs made by the user during the challenge.     |

## DKDriverStats

| Field      | Type   | Description                                                      |
| ---------- | ------ | ---------------------------------------------------------------- |
| rank       | Int    | Driver’s rank for this challenge                                 |
| numberTrip | Int    | Number of trips made during the challenge                        |
| distance   | Double | Total distance (in km) made during the challenge                 |
| duration   | Double | Total duration (in hours) of the trips made during the challenge |
| score      | Double | Score for the challenge                                          |

## DKChallengeStats

| Field        | Type   | Description                                            |
| ------------ | ------ | ------------------------------------------------------ |
| numberDriver | Int    | Total number of drivers participating in the challenge |
| numberTrip   | Int    | Total number of trips done for this challenge          |
| distance     | Double | Total distance (in km) travelled for this challenge    |
| duration     | Double | Total trips duration (in hours) of the challenge       |
| score        | Double | Average challenge score                                |
| minScore     | Double | Lowest score for this challenge                        |
| maxScore     | Double | Best score for this challenge                          |

## DKDriverRanked

| Field        | Type    | Description                              |
| ------------ | ------- | ---------------------------------------- |
| pseudo       | String? | Pseudo of the driver                     |
| rank         | Int     | Driver’s rank                            |
| score        | Double  | Driver’s score on ten                    |
| previousRank | Int     | Driver’s previous rank                   |
| distance     | Double  | Distance travelled by the driver (in km) |

## JoinChallengeSyncStatus

| Value             | Description                                                                   |
| ----------------- | ----------------------------------------------------------------------------- |
| success           | The challenge is joined successfully                                          |
| alreadyJoined     | The user has already joined the given challenge                               |
| notFound          | There is no existing challenge with this *challengeId*                        |
| failedToJoin      | Couldn’t join the challenge. Can occur for example if the user has no network |
| alreadyInProgress | The request to join the challenge is already in progress                      |


---

# 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://docs.drivequant.com/challenge/ios/references-ios.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.
