{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/fence/json-schema/fence-declaration-run-asset-schema.json",
  "title": "DeclarationRunAsset",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/fence-openapi.json#/components/schemas/DeclarationRunAsset",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "asset_id",
    "external_asset_id",
    "contract_external_id",
    "properties",
    "results"
  ],
  "properties": {
    "asset_id": {
      "type": "string",
      "format": "uuid"
    },
    "external_asset_id": {
      "type": "string"
    },
    "contract_external_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "properties": {
      "oneOf": [
        {
          "$ref": "#/$defs/DealSpecificProperties"
        },
        {
          "type": "null"
        }
      ]
    },
    "is_eligible": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "is_declarable": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DeclarationAssetStepResult"
      }
    }
  },
  "$defs": {
    "DealSpecificProperties": {
      "type": "object",
      "description": "Fields vary by deal and are defined in the integration-specific schema provided during onboarding.",
      "additionalProperties": true
    },
    "DeclarationAssetResultStatus": {
      "type": "string",
      "enum": [
        "successful",
        "unsuccessful",
        "failed"
      ]
    },
    "DeclarationAssetStepResult": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "step_name",
        "status",
        "details"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "step_name": {
          "type": "string"
        },
        "status": {
          "$ref": "#/$defs/DeclarationAssetResultStatus"
        },
        "details": {
          "oneOf": [
            {
              "type": "object",
              "additionalProperties": true
            },
            {
              "type": "null"
            }
          ]
        }
      }
    }
  }
}