{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pricklymails-com/json-schema/pricklymails-com-wallet-transaction-groups-response-schema.json",
  "title": "WalletTransactionGroupsResponse",
  "description": "JSON response body for `GET /api/wallet/transactions/grouped`.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pricklymails-com-wallet-api-openapi.yml#/components/schemas/WalletTransactionGroupsResponse",
  "type": "object",
  "required": [
    "groups",
    "limit",
    "offset"
  ],
  "properties": {
    "groups": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/WalletTransactionGroupItem"
      },
      "description": "Transaction groups of the page."
    },
    "limit": {
      "type": "integer",
      "format": "int64",
      "description": "Page size applied after clamping, counted in groups."
    },
    "offset": {
      "type": "integer",
      "format": "int64",
      "description": "Offset applied, counted in groups."
    }
  },
  "$defs": {
    "WalletTransactionGroupItem": {
      "type": "object",
      "description": "A single entry of the job-grouped response: every transaction sharing the same `job_uuid` collapsed into one group.",
      "required": [
        "last_status",
        "net_amount",
        "occurred_at",
        "entries"
      ],
      "properties": {
        "entries": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WalletTransactionItem"
          },
          "description": "Every transaction in the group, oldest first (for example a reservation followed by its commit or cancel)."
        },
        "job_uuid": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "Public UUID of the linked verification job. `null` for a credit or top-up, which is its own single-entry group."
        },
        "last_status": {
          "type": "string",
          "description": "The transaction type of the group's most recent entry (`\"Reservation\"`, `\"Commit\"`, `\"Cancel\"`, `\"Credit\"` or\n`\"Debit\"`), which is the job's current billing state."
        },
        "net_amount": {
          "type": "integer",
          "format": "int64",
          "description": "The signed net effect of the whole group on the wallet: positive for a net inflow (a credit, or a\ncanceled/refunded reservation), negative for a net outflow (a debit, a pending reservation, or a\ncommitted/billed job)."
        },
        "occurred_at": {
          "type": "string",
          "format": "date-time",
          "description": "Timestamp of the group's most recent entry."
        }
      }
    },
    "WalletTransactionItem": {
      "type": "object",
      "description": "A single transaction item in the response list.",
      "required": [
        "transaction_type",
        "amount",
        "context",
        "occurred_at"
      ],
      "properties": {
        "amount": {
          "type": "integer",
          "format": "int32",
          "description": "Token amount moved.",
          "minimum": 0
        },
        "context": {
          "type": "string",
          "description": "Short label describing why the transaction happened."
        },
        "job_uuid": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "Public UUID of the linked verification job, when the transaction is tied to one.\n`null` for a credit or top-up transaction, which carries no job."
        },
        "occurred_at": {
          "type": "string",
          "format": "date-time",
          "description": "RFC 3339 timestamp of the transaction."
        },
        "transaction_type": {
          "type": "string",
          "description": "Transaction type: `\"Credit\"`, `\"Debit\"`, `\"Reservation\"`, `\"Commit\"` or `\"Cancel\"`."
        }
      }
    }
  }
}