# app.starrysky.streak.inventory

> Published by [starrysky.app](https://lexicon.garden/identity/did:plc:pdftantb2wpnczkhusrixbpy)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:pdftantb2wpnczkhusrixbpy/app.starrysky.streak.inventory)
- [Documentation](https://lexicon.garden/lexicon/did:plc:pdftantb2wpnczkhusrixbpy/app.starrysky.streak.inventory/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:pdftantb2wpnczkhusrixbpy/app.starrysky.streak.inventory/examples)

## Definitions

### `app.starrysky.streak.inventory`

**Type**: `record`

A ledger record tracking the accumulation and expenditure of streak freezes. Forms a linked chain via the 'prev' field.

**Key**: `tid`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `prev` | `string` (cid) | No | Link to the previous inventory record in the ledger chain. Null if initializing. |
| `action` | `string` | Yes | The transaction type occurring in this ledger entry. |
| `policy` | `string` (at-uri) | Yes | The URI of the policy governing this streak's rules. |
| `balance` | `integer` | Yes | The total number of freezes available *after* this action is applied. |
| `subject` | `string` | Yes | The name of the habit this inventory ledger belongs to (e.g., 'Daily Coding'). |
| `createdAt` | `string` (datetime) | Yes | Timestamp of when this inventory ledger entry was created. |
| `originService` | `string` | Yes | The NSID of the service this inventory applies to. |
| `relatedCheckin` | `string` (cid) | No | The CID of the checkin record that earned or spent these freezes. |
| `relatedFreezeGrant` | `string` (cid) | No | The CID of the freezegrant record being claimed. |

## Raw Schema

```json
{
  "id": "app.starrysky.streak.inventory",
  "defs": {
    "main": {
      "key": "tid",
      "type": "record",
      "record": {
        "type": "object",
        "required": [
          "originService",
          "policy",
          "subject",
          "action",
          "balance",
          "createdAt"
        ],
        "properties": {
          "prev": {
            "type": "string",
            "format": "cid",
            "description": "Link to the previous inventory record in the ledger chain. Null if initializing."
          },
          "action": {
            "type": "string",
            "description": "The transaction type occurring in this ledger entry.",
            "knownValues": [
              "earn",
              "spend",
              "initialize",
              "claim",
              "spend_and_earn"
            ]
          },
          "policy": {
            "type": "string",
            "format": "at-uri",
            "description": "The URI of the policy governing this streak's rules."
          },
          "balance": {
            "type": "integer",
            "description": "The total number of freezes available *after* this action is applied."
          },
          "subject": {
            "type": "string",
            "description": "The name of the habit this inventory ledger belongs to (e.g., 'Daily Coding')."
          },
          "createdAt": {
            "type": "string",
            "format": "datetime",
            "description": "Timestamp of when this inventory ledger entry was created."
          },
          "originService": {
            "type": "string",
            "description": "The NSID of the service this inventory applies to."
          },
          "relatedCheckin": {
            "type": "string",
            "format": "cid",
            "description": "The CID of the checkin record that earned or spent these freezes."
          },
          "relatedFreezeGrant": {
            "type": "string",
            "format": "cid",
            "description": "The CID of the freezegrant record being claimed."
          }
        }
      },
      "description": "A ledger record tracking the accumulation and expenditure of streak freezes. Forms a linked chain via the 'prev' field."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
