# dev.tsunagite.score

> Published by [tsunagite.dev](https://lexicon.garden/identity/did:plc:pz4sp2vf5w26wnaee253gfms)

✓ This is the authoritative definition for this NSID.

## Description

Definitions related to scores in games hosting leaderboards via Tsunagite.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:pz4sp2vf5w26wnaee253gfms/dev.tsunagite.score)
- [Documentation](https://lexicon.garden/lexicon/did:plc:pz4sp2vf5w26wnaee253gfms/dev.tsunagite.score/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:pz4sp2vf5w26wnaee253gfms/dev.tsunagite.score/examples)

## Definitions

### `dev.tsunagite.score#enum`

**Type**: `object`

An indexable named score component.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `value` | `string` (record-key) | Yes | The internal ID of the value, matching with an allowed enum value defined by the game record. |

### `dev.tsunagite.score`

**Type**: `record`

A score in a game hosting leaderboards via Tsunagite.

**Key**: `tid`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `game` | `string` (at-uri) | Yes | The game this score was earned in. URI must point to a record of type `dev.tsunagite.game`. |
| `mode` | `string` | No | The game mode this score was earned on. Must be a mode defined by the game record if present. |
| `song` | `string` (at-uri) | Yes | The song this score was earned on. URI must point to a record of type `dev.tsunagite.song`. |
| `chart` | `string` (at-uri) | Yes | The chart this score was earned on. URI must point to a record of type `dev.tsunagite.chart`. |
| `version` | `bytes` | No | The md5 hash of the chart version this score was earned on. Optional if you will not perform leaderboard resets upon any chart changes. |
| `scoredAt` | `string` (datetime) | No | The time this score was originally earned. |
| `judgments` | `object` | Yes | A map of judgment names to the integer judgment amounts earned during play. |
| `totalLate` | `integer` | No | The total number of judgments earned when hitting late. |
| `totalEarly` | `integer` | No | The total number of judgments earned when hitting early. |
| `inputMethod` | `string` | No | The input method this score was earned using. Must be an input method defined by the game record if present. |
| `scoreComponents` | `object` | Yes | The components that make up this score, as defined by the game record. |

### `dev.tsunagite.score#text`

**Type**: `object`

A fallback score component.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `id` | `string` (record-key) | Yes | The internal ID of this component, matching with a text score defined by the game record. |
| `value` | `string` | Yes | The text value of this score. |

### `dev.tsunagite.score#points`

**Type**: `object`

An integer point score component.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `value` | `integer` | Yes | The number of points earned, capped by the limit defined by the game record if present. |

### `dev.tsunagite.score#percentage`

**Type**: `object`

A percentage score component.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `value` | `string` | Yes | The percentage score earned, capped and formatted by the limits defined by the game record. Stored as a decimal number without a percent sign. |

## Raw Schema

```json
{
  "id": "dev.tsunagite.score",
  "defs": {
    "enum": {
      "type": "object",
      "required": [
        "value"
      ],
      "properties": {
        "value": {
          "type": "string",
          "format": "record-key",
          "description": "The internal ID of the value, matching with an allowed enum value defined by the game record."
        }
      },
      "description": "An indexable named score component."
    },
    "main": {
      "key": "tid",
      "type": "record",
      "record": {
        "type": "object",
        "required": [
          "game",
          "song",
          "chart",
          "judgments",
          "scoreComponents"
        ],
        "properties": {
          "game": {
            "type": "string",
            "format": "at-uri",
            "description": "The game this score was earned in. URI must point to a record of type `dev.tsunagite.game`."
          },
          "mode": {
            "type": "string",
            "description": "The game mode this score was earned on. Must be a mode defined by the game record if present."
          },
          "song": {
            "type": "string",
            "format": "at-uri",
            "description": "The song this score was earned on. URI must point to a record of type `dev.tsunagite.song`."
          },
          "chart": {
            "type": "string",
            "format": "at-uri",
            "description": "The chart this score was earned on. URI must point to a record of type `dev.tsunagite.chart`."
          },
          "version": {
            "type": "bytes",
            "maxLength": 16,
            "minLength": 16,
            "description": "The md5 hash of the chart version this score was earned on. Optional if you will not perform leaderboard resets upon any chart changes."
          },
          "scoredAt": {
            "type": "string",
            "format": "datetime",
            "description": "The time this score was originally earned."
          },
          "judgments": {
            "type": "object",
            "properties": {
              "$keyFormat": {
                "type": "string",
                "format": "record-key",
                "maxLength": 32,
                "minLength": 1,
                "description": "Must match a judgment defined by the game record."
              },
              "$valueType": {
                "type": "object",
                "required": [
                  "total"
                ],
                "properties": {
                  "late": {
                    "type": "integer",
                    "description": "The number of judgments of this type earned when hitting late."
                  },
                  "early": {
                    "type": "integer",
                    "description": "The number of judgments of this type earned when hitting early."
                  },
                  "total": {
                    "type": "integer",
                    "description": "The total number of judgments of this type earned."
                  }
                }
              }
            },
            "description": "A map of judgment names to the integer judgment amounts earned during play."
          },
          "totalLate": {
            "type": "integer",
            "description": "The total number of judgments earned when hitting late."
          },
          "totalEarly": {
            "type": "integer",
            "description": "The total number of judgments earned when hitting early."
          },
          "inputMethod": {
            "type": "string",
            "description": "The input method this score was earned using. Must be an input method defined by the game record if present."
          },
          "scoreComponents": {
            "type": "object",
            "properties": {
              "$keyFormat": {
                "type": "string",
                "format": "record-key",
                "maxLength": 32,
                "minLength": 1,
                "description": "Must match an ID defined by the game record, as well as using the same type."
              },
              "$valueType": {
                "refs": [
                  "#enum",
                  "#points",
                  "#percentage",
                  "#text"
                ],
                "type": "union",
                "description": "If you need a component type that doesn't exist yet, contact @lemmaeof.gay"
              }
            },
            "description": "The components that make up this score, as defined by the game record."
          }
        }
      },
      "description": "A score in a game hosting leaderboards via Tsunagite."
    },
    "text": {
      "type": "object",
      "required": [
        "id",
        "value"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "record-key",
          "maxLength": 32,
          "minLength": 1,
          "description": "The internal ID of this component, matching with a text score defined by the game record."
        },
        "value": {
          "type": "string",
          "description": "The text value of this score."
        }
      },
      "description": "A fallback score component."
    },
    "points": {
      "type": "object",
      "required": [
        "value"
      ],
      "properties": {
        "value": {
          "type": "integer",
          "description": "The number of points earned, capped by the limit defined by the game record if present."
        }
      },
      "description": "An integer point score component."
    },
    "percentage": {
      "type": "object",
      "required": [
        "value"
      ],
      "properties": {
        "value": {
          "type": "string",
          "description": "The percentage score earned, capped and formatted by the limits defined by the game record. Stored as a decimal number without a percent sign."
        }
      },
      "description": "A percentage score component."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1,
  "description": "Definitions related to scores in games hosting leaderboards via Tsunagite.",
  "featureFlags": [
    "dev.tsunagite.dictionaryObject"
  ]
}
```
