{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://402rates.com/schemas/rwa-access-evidence-v2.json",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "report_version",
    "capability",
    "status",
    "data_status",
    "selection",
    "tracked_instrument_count",
    "available_records",
    "records",
    "sources",
    "limitations",
    "disclaimer"
  ],
  "properties": {
    "schema_version": {
      "const": "2.0.0"
    },
    "report_version": {
      "const": "2.0.0"
    },
    "capability": {
      "const": "compass.rwa.access_evidence"
    },
    "status": {
      "const": "available"
    },
    "data_status": {
      "const": "dated_documentary_evidence"
    },
    "selection": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "ticker",
        "record_id"
      ],
      "properties": {
        "ticker": {
          "type": [
            "string",
            "null"
          ]
        },
        "record_id": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "tracked_instrument_count": {
      "type": "integer",
      "minimum": 0
    },
    "available_records": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "record_id",
          "record_type",
          "name",
          "ticker"
        ],
        "properties": {
          "record_id": {
            "type": "string"
          },
          "record_type": {
            "enum": [
              "instrument",
              "access",
              "protocol",
              "event"
            ]
          },
          "name": {
            "type": "string"
          },
          "ticker": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "records": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "record_id",
          "record_type",
          "name",
          "evidence_status",
          "tracked_instrument_id",
          "ticker",
          "instrument",
          "access",
          "protocol",
          "event",
          "source_ids",
          "limitations"
        ],
        "properties": {
          "record_id": {
            "type": "string"
          },
          "record_type": {
            "enum": [
              "instrument",
              "access",
              "protocol",
              "event"
            ]
          },
          "name": {
            "type": "string"
          },
          "evidence_status": {
            "type": "string"
          },
          "tracked_instrument_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "ticker": {
            "type": [
              "string",
              "null"
            ]
          },
          "instrument": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "legal_name",
                  "issuer",
                  "family",
                  "deployments"
                ],
                "properties": {
                  "legal_name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "issuer": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "family": {
                    "type": "string"
                  },
                  "deployments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "chain",
                        "address",
                        "verification",
                        "verified_on"
                      ],
                      "properties": {
                        "chain": {
                          "type": "string"
                        },
                        "address": {
                          "type": "string"
                        },
                        "verification": {
                          "type": "string"
                        },
                        "verified_on": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date"
                        }
                      }
                    }
                  }
                }
              }
            ]
          },
          "access": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "relationship",
                  "candidate_name",
                  "candidate_symbol",
                  "share_class",
                  "legal_claim",
                  "token_contract",
                  "chain",
                  "terms",
                  "investor_categories",
                  "source_ids"
                ],
                "properties": {
                  "relationship": {
                    "type": "string"
                  },
                  "candidate_name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "candidate_symbol": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "share_class": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "legal_claim": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "token_contract": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "chain": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "terms": {
                    "anyOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "schema_version",
                          "minimum_subscription",
                          "minimum_redemption",
                          "subscription_fee_bps",
                          "redemption_fee_bps",
                          "redemption",
                          "access_requirements",
                          "token_chains",
                          "subscription_chains",
                          "redemption_chains"
                        ],
                        "properties": {
                          "schema_version": {
                            "type": "string"
                          },
                          "minimum_subscription": {
                            "type": "object",
                            "required": [
                              "status",
                              "issuer_stated",
                              "source_url",
                              "retrieved_at"
                            ],
                            "properties": {
                              "status": {
                                "enum": [
                                  "known",
                                  "conditional",
                                  "conflicting",
                                  "unknown"
                                ]
                              },
                              "issuer_stated": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source_url": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "retrieved_at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": true
                          },
                          "minimum_redemption": {
                            "type": "object",
                            "required": [
                              "status",
                              "issuer_stated",
                              "source_url",
                              "retrieved_at"
                            ],
                            "properties": {
                              "status": {
                                "enum": [
                                  "known",
                                  "conditional",
                                  "conflicting",
                                  "unknown"
                                ]
                              },
                              "issuer_stated": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source_url": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "retrieved_at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": true
                          },
                          "subscription_fee_bps": {
                            "type": "object",
                            "required": [
                              "status",
                              "issuer_stated",
                              "source_url",
                              "retrieved_at"
                            ],
                            "properties": {
                              "status": {
                                "enum": [
                                  "known",
                                  "conditional",
                                  "conflicting",
                                  "unknown"
                                ]
                              },
                              "issuer_stated": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source_url": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "retrieved_at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": true
                          },
                          "redemption_fee_bps": {
                            "type": "object",
                            "required": [
                              "status",
                              "issuer_stated",
                              "source_url",
                              "retrieved_at"
                            ],
                            "properties": {
                              "status": {
                                "enum": [
                                  "known",
                                  "conditional",
                                  "conflicting",
                                  "unknown"
                                ]
                              },
                              "issuer_stated": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source_url": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "retrieved_at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": true
                          },
                          "redemption": {
                            "type": "object",
                            "required": [
                              "status",
                              "issuer_stated",
                              "source_url",
                              "retrieved_at"
                            ],
                            "properties": {
                              "status": {
                                "enum": [
                                  "known",
                                  "conditional",
                                  "conflicting",
                                  "unknown"
                                ]
                              },
                              "issuer_stated": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source_url": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "retrieved_at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": true
                          },
                          "access_requirements": {
                            "type": "object",
                            "required": [
                              "status",
                              "issuer_stated",
                              "source_url",
                              "retrieved_at"
                            ],
                            "properties": {
                              "status": {
                                "enum": [
                                  "known",
                                  "conditional",
                                  "conflicting",
                                  "unknown"
                                ]
                              },
                              "issuer_stated": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source_url": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "retrieved_at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": true
                          },
                          "token_chains": {
                            "type": "object",
                            "required": [
                              "status",
                              "issuer_stated",
                              "source_url",
                              "retrieved_at"
                            ],
                            "properties": {
                              "status": {
                                "enum": [
                                  "known",
                                  "conditional",
                                  "conflicting",
                                  "unknown"
                                ]
                              },
                              "issuer_stated": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source_url": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "retrieved_at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": true
                          },
                          "subscription_chains": {
                            "type": "object",
                            "required": [
                              "status",
                              "issuer_stated",
                              "source_url",
                              "retrieved_at"
                            ],
                            "properties": {
                              "status": {
                                "enum": [
                                  "known",
                                  "conditional",
                                  "conflicting",
                                  "unknown"
                                ]
                              },
                              "issuer_stated": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source_url": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "retrieved_at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": true
                          },
                          "redemption_chains": {
                            "type": "object",
                            "required": [
                              "status",
                              "issuer_stated",
                              "source_url",
                              "retrieved_at"
                            ],
                            "properties": {
                              "status": {
                                "enum": [
                                  "known",
                                  "conditional",
                                  "conflicting",
                                  "unknown"
                                ]
                              },
                              "issuer_stated": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source_url": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "retrieved_at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": true
                          }
                        }
                      }
                    ]
                  },
                  "investor_categories": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "source_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            ]
          },
          "protocol": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "chain",
                  "program_address",
                  "deployment_status",
                  "software_license",
                  "documented_source_revision",
                  "documented_idl_version",
                  "account_name",
                  "account_size_bytes",
                  "upgradeable",
                  "settlement_model",
                  "create_permission",
                  "funding_method",
                  "settlement_signer",
                  "cancel_signer",
                  "reclaim_reject_recover_signers",
                  "blocked_mint_extensions",
                  "token_programs",
                  "source_ids"
                ],
                "properties": {
                  "chain": {
                    "type": "string"
                  },
                  "program_address": {
                    "type": "string"
                  },
                  "deployment_status": {
                    "type": "string"
                  },
                  "software_license": {
                    "type": "string"
                  },
                  "documented_source_revision": {
                    "type": "string"
                  },
                  "documented_idl_version": {
                    "type": "string"
                  },
                  "account_name": {
                    "type": "string"
                  },
                  "account_size_bytes": {
                    "type": "integer"
                  },
                  "upgradeable": {
                    "type": "boolean"
                  },
                  "settlement_model": {
                    "type": "string"
                  },
                  "create_permission": {
                    "type": "string"
                  },
                  "funding_method": {
                    "type": "string"
                  },
                  "settlement_signer": {
                    "type": "string"
                  },
                  "cancel_signer": {
                    "type": "string"
                  },
                  "reclaim_reject_recover_signers": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "blocked_mint_extensions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "token_programs": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "source_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            ]
          },
          "event": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "kind",
                  "occurred_on",
                  "date_basis",
                  "subjects",
                  "summary",
                  "regulatory_effect"
                ],
                "properties": {
                  "kind": {
                    "enum": [
                      "cooperation_announced",
                      "regulatory_discussion",
                      "transaction_reported"
                    ]
                  },
                  "occurred_on": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "date_basis": {
                    "type": "string"
                  },
                  "subjects": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "summary": {
                    "type": "string"
                  },
                  "regulatory_effect": {
                    "type": "string"
                  }
                }
              }
            ]
          },
          "source_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "record_type": {
                  "const": "instrument"
                }
              }
            },
            "then": {
              "properties": {
                "instrument": {
                  "type": "object"
                },
                "access": {
                  "type": "null"
                },
                "protocol": {
                  "type": "null"
                },
                "event": {
                  "type": "null"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "record_type": {
                  "const": "access"
                }
              }
            },
            "then": {
              "properties": {
                "instrument": {
                  "type": "null"
                },
                "access": {
                  "type": "object"
                },
                "protocol": {
                  "type": "null"
                },
                "event": {
                  "type": "null"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "record_type": {
                  "const": "protocol"
                }
              }
            },
            "then": {
              "properties": {
                "instrument": {
                  "type": "null"
                },
                "access": {
                  "type": "null"
                },
                "protocol": {
                  "type": "object"
                },
                "event": {
                  "type": "null"
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "record_type": {
                  "const": "event"
                }
              }
            },
            "then": {
              "properties": {
                "instrument": {
                  "type": "null"
                },
                "access": {
                  "type": "null"
                },
                "protocol": {
                  "type": "null"
                },
                "event": {
                  "type": "object"
                }
              }
            }
          }
        ]
      }
    },
    "sources": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source_id",
          "publisher",
          "url",
          "kind",
          "published_on",
          "event_on",
          "checked_on",
          "checked_at",
          "check_precision",
          "read_status",
          "revision",
          "note"
        ],
        "properties": {
          "source_id": {
            "type": "string"
          },
          "publisher": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "kind": {
            "type": "string"
          },
          "published_on": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "event_on": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "checked_on": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "checked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "check_precision": {
            "enum": [
              "date",
              "timestamp",
              "unknown"
            ]
          },
          "read_status": {
            "type": "string"
          },
          "revision": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": "string"
          }
        }
      }
    },
    "limitations": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "disclaimer": {
      "const": "Informational data and calculation service only. Not investment, legal, tax or accounting advice; not an offer, solicitation, recommendation, or determination of eligibility or suitability. Source and onchain data may be inaccurate, incomplete, delayed, stale or conflicting. Verify independently. The caller remains responsible for every decision and action; 402rates.com does not execute investment transactions or hold financial assets on the caller's behalf."
    }
  }
}
