{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/carbonmark-com/json-schema/carbonmark-com-retirement-schema.json",
  "title": "Retirement",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/carbonmark-com-openapi.json#/components/schemas/Retirement",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "bridgeId": {
      "description": "ID of the bridge used to tokenize the tokens involved in the retirement",
      "type": "string"
    },
    "chainId": {
      "description": "ID of the chain the retirement occurred on",
      "type": "number"
    },
    "asyncRetireStatus": {
      "deprecated": true,
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "AWAITING"
          ]
        },
        {
          "type": "string",
          "enum": [
            "FINALIZED"
          ]
        },
        {
          "type": "string",
          "enum": [
            "REQUESTED"
          ]
        },
        {
          "type": "string",
          "enum": [
            "REVERTED"
          ]
        }
      ]
    },
    "amount": {
      "description": "Amount of token retired",
      "type": "number"
    },
    "hash": {
      "description": "Retirement transaction hash",
      "type": "string"
    },
    "beneficiaryAddress": {
      "description": "Retirement beneficiary address",
      "type": "string"
    },
    "beneficiaryName": {
      "description": "Retirement beneficiary name",
      "type": "string"
    },
    "retirementMessage": {
      "description": "Retirement message",
      "type": "string"
    },
    "retiringAddress": {
      "description": "Address of the wallet from which the retirement transaction originated",
      "type": "string"
    },
    "retiringName": {
      "description": "Name of the retiring entity",
      "type": "string"
    },
    "timestamp": {
      "description": "Date of the retirement",
      "type": "number"
    },
    "token": {
      "$ref": "#/$defs/Token"
    },
    "creditId": {
      "$ref": "#/$defs/CarbonCreditId"
    },
    "index": {
      "description": "Retirement index (Unique per beneficiary)",
      "type": "number"
    },
    "onChainExplorerUrl": {
      "anyOf": [
        {
          "description": "URL of the retirement transaction on the appropriate on-chain explorer",
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "viewRetirementUrl": {
      "anyOf": [
        {
          "description": "URL of the retirement transaction on Carbonmark",
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "registryCertificateUrl": {
      "anyOf": [
        {
          "description": "URL of the retirement certificate on the native registry, when the registry exposes one. Currently only populated for ICR retirements.",
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "asyncRetirement": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "status": {
              "description": "Status of the asynchronous retirement",
              "anyOf": [
                {
                  "title": "AWAITING",
                  "type": "string",
                  "enum": [
                    "AWAITING"
                  ]
                },
                {
                  "title": "FINALIZED",
                  "type": "string",
                  "enum": [
                    "FINALIZED"
                  ]
                },
                {
                  "title": "REQUESTED",
                  "type": "string",
                  "enum": [
                    "REQUESTED"
                  ]
                },
                {
                  "title": "REVERTED",
                  "type": "string",
                  "enum": [
                    "REVERTED"
                  ]
                }
              ]
            },
            "certificateUrl": {
              "description": "URL of the asynchronous retirement certificate request",
              "type": "string"
            }
          },
          "required": [
            "status",
            "certificateUrl"
          ]
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "id",
    "chainId",
    "amount",
    "hash",
    "beneficiaryAddress",
    "retiringAddress",
    "timestamp"
  ],
  "$defs": {
    "CarbonCreditId": {
      "type": "object",
      "properties": {
        "vintage": {
          "description": "Vintage of the carbon credit",
          "type": "number"
        },
        "projectId": {
          "description": "ID of the project associated with this credit",
          "type": "string"
        },
        "creditId": {
          "description": "ID of the credit",
          "type": "string"
        }
      },
      "required": [
        "vintage",
        "projectId"
      ]
    },
    "Token": {
      "type": "object",
      "properties": {
        "id": {
          "description": "Identifier of the token",
          "type": "string"
        },
        "address": {
          "description": "Address of the credit being sold",
          "type": "string"
        },
        "decimals": {
          "description": "The smallest divisible unit for the token ",
          "type": "number"
        },
        "tokenId": {
          "anyOf": [
            {
              "description": "ID of the credit being sold (0 for ERC20 tokens)",
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "tokenStandard": {
          "description": "Standard of the Token",
          "anyOf": [
            {
              "title": "erc20",
              "type": "string",
              "enum": [
                "erc20"
              ]
            },
            {
              "title": "erc1155",
              "type": "string",
              "enum": [
                "erc1155"
              ]
            }
          ]
        },
        "name": {
          "description": "Name of the token.",
          "type": "string"
        },
        "isExAnte": {
          "description": "Ex-ante credits refer to those that are issued on the basis of predicted or expected future carbon emissions reductions or removals.",
          "type": "boolean"
        },
        "symbol": {
          "description": "Symbol of the token",
          "type": "string"
        },
        "creditTokenId": {
          "description": "Unique identifier for this token",
          "type": "string"
        }
      },
      "required": [
        "id",
        "address",
        "decimals",
        "tokenStandard",
        "name",
        "isExAnte",
        "symbol",
        "creditTokenId"
      ]
    }
  }
}