{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/recurly/json-schema/recurly-subscription-activities-result-dto-schema.json",
  "title": "SubscriptionActivitiesResultDto",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/recurly-subscriptionactivities-api-api-openapi.yml#/components/schemas/SubscriptionActivitiesResultDto",
  "type": "object",
  "properties": {
    "page": {
      "type": "number",
      "description": "Current page number"
    },
    "limit": {
      "type": "number",
      "description": "Number of items per page"
    },
    "totalItems": {
      "type": "number",
      "description": "Total number of items"
    },
    "totalPages": {
      "type": "number",
      "description": "Total number of pages"
    },
    "subscriptionActivities": {
      "description": "Array of subscription activities for the current page",
      "type": "array",
      "items": {
        "$ref": "#/$defs/SubscriptionActivityDto"
      }
    }
  },
  "required": [
    "page",
    "limit",
    "totalItems",
    "totalPages",
    "subscriptionActivities"
  ],
  "$defs": {
    "ApiTokenDto": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "tokenName": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "tokenName"
      ]
    },
    "CancellationMetaDataDto": {
      "type": "object",
      "properties": {
        "cancelReason": {
          "type": "string",
          "description": "The cancellation reason configured"
        },
        "cancelReasonComments": {
          "type": "string",
          "description": "The cancellation reason provided by the end user"
        },
        "cancellationQuestionId": {
          "type": "string",
          "description": "The cancellation question id"
        },
        "lineId": {
          "type": [
            "string",
            "null"
          ],
          "description": "The cancellation question id"
        }
      },
      "required": [
        "cancelReason",
        "cancelReasonComments",
        "cancellationQuestionId",
        "lineId"
      ]
    },
    "SubscriptionActivityDto": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "createdAt": {
          "format": "date-time",
          "type": "string"
        },
        "updatedAt": {
          "format": "date-time",
          "type": "string"
        },
        "subscriptionId": {
          "type": "string",
          "description": "The id of the subscription"
        },
        "type": {
          "type": "string",
          "description": "The type of the activity"
        },
        "description": {
          "type": "string"
        },
        "user": {
          "type": "string",
          "description": "The initiator of the activity",
          "enum": [
            "Store Admin",
            "Customer",
            "Recurly System",
            "Prive System",
            "Shopper",
            "Bulk Updater"
          ]
        },
        "apiToken": {
          "description": "The API token if the activity was triggered by API",
          "allOf": [
            {
              "$ref": "#/$defs/ApiTokenDto"
            }
          ]
        },
        "eventTimestamp": {
          "format": "date-time",
          "type": "string"
        },
        "targetEntityType": {
          "type": [
            "string",
            "null"
          ],
          "description": "The type of the target entity",
          "enum": [
            "SUBSCRIPTION",
            "SUBSCRIPTION_LINE",
            "ONE_TIME_ADD_ON",
            "ORDER",
            "BILLING_ATTEMPT",
            "SUBSCRIPTION_DISCOUNT_CODE",
            "DELIVERY_CONDITION",
            null
          ]
        },
        "targetEntityId": {
          "type": [
            "string",
            "null"
          ],
          "description": "The id of the target entity"
        },
        "oldData": {
          "type": [
            "object",
            "null"
          ]
        },
        "newData": {
          "type": [
            "object",
            "null"
          ]
        },
        "removeLineData": {
          "allOf": [
            {
              "$ref": "#/$defs/CancellationMetaDataDto"
            }
          ]
        },
        "cancelContractData": {
          "type": [
            "object",
            "null"
          ]
        },
        "oldLines": {
          "type": [
            "object",
            "null"
          ]
        },
        "newLines": {
          "type": [
            "object",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "createdAt",
        "updatedAt",
        "subscriptionId",
        "type",
        "description",
        "user",
        "apiToken",
        "eventTimestamp",
        "targetEntityType",
        "targetEntityId",
        "oldData",
        "newData",
        "removeLineData",
        "cancelContractData",
        "oldLines",
        "newLines"
      ]
    }
  }
}