{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/flashdata-dev/json-schema/flashdata-dev-credit-transaction-schema.json",
  "title": "CreditTransaction",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/flashdata-dev-credits-api-openapi.yml#/components/schemas/CreditTransaction",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "type",
    "deltaCredits",
    "balanceAfterCredits",
    "createdAt"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^ctx_"
    },
    "type": {
      "$ref": "#/$defs/CreditEntryType"
    },
    "deltaCredits": {
      "type": "number",
      "multipleOf": 0.001
    },
    "balanceAfterCredits": {
      "type": [
        "number",
        "null"
      ],
      "multipleOf": 0.001,
      "description": "Signed settled balance after this immutable transaction, when recorded."
    },
    "description": {
      "type": "string"
    },
    "requestId": {
      "type": [
        "string",
        "null"
      ]
    },
    "jobId": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "CreditEntryType": {
      "type": "string",
      "enum": [
        "subscription_grant",
        "topup_grant",
        "payment_reversal",
        "admin_adjustment",
        "trial_grant"
      ]
    }
  }
}