{
  "$id": "https://vendia.net/schemas/css/schema.json",
  "$schema": "https://json-schema.org/draft-07/schema#",
  "description": "Provide full chain of custody of a loan from its origination, to servicing, to securitization",
  "properties": {
    "Disclosure": {
      "description": "A disclosure calculation for a given security, either Level 1 or Level 2",
      "items": {
        "properties": {
          "disclosureType": {
            "description": "The type of disclosure, one per calculation",
            "enum": [
              "WeightedAverageInterestRatePercent",
              "WeightedAverageLoanAge"
            ],
            "type": "string"
          },
          "disclosureValue": {
            "description": "The value of the disclosure",
            "type": "number"
          },
          "reportingPeriod": {
            "description": "Reporting period",
            "pattern": "[0-9]{4}-(0[1-9]|1[0-2])",
            "type": "string"
          },
          "securityIdentifier": {
            "description": "Unique identifier (CUSIP) of this security",
            "pattern": "[A-Z0-9]{9}",
            "type": "string"
          },
          "securityType": {
            "description": "The type of security, either L1 or L2",
            "enum": [
              "L1",
              "L2"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "Loan": {
      "description": "Whole loans that need to be serviced, and may securitized",
      "items": {
        "properties": {
          "borrowerCreditScore": {
            "description": "Credit score of borrower",
            "maximum": 850,
            "minimum": 0,
            "type": "integer"
          },
          "delinquencyStatus": {
            "description": "Current delinquency status of the loan, based on the current reporting period",
            "enum": [
              "CURRENT",
              "LATE",
              "DELINQUENT"
            ],
            "type": "string"
          },
          "interestRatePercent": {
            "description": "Current loan interest rate, as a percent",
            "maximum": 100,
            "minimum": 0,
            "type": "number"
          },
          "loanCollaborators": {
            "properties": {
              "lenderIdentifier": {
                "description": "Identifier of the lender",
                "type": "string"
              },
              "ownerIdentifier": {
                "description": "Identifier of the loan owner",
                "type": "string"
              },
              "securitizerIdentifier": {
                "description": "Identifier of the securitizer",
                "type": "string"
              },
              "servicerIdentifier": {
                "description": "Identifier of the servicer",
                "type": "string"
              }
            },
            "type": "object"
          },
          "loanIdentifier": {
            "description": "Globally unique loan identifier, set by the original lender",
            "pattern": "[0-9]{16}",
            "type": "string"
          },
          "loanToValuePercent": {
            "description": "Current loan to value ratio, as a percentage",
            "maximum": 100,
            "minimum": 0,
            "type": "number"
          },
          "numberOfUnits": {
            "description": "Number of units in the property",
            "minimum": 0,
            "type": "integer"
          },
          "originationDate": {
            "description": "Date loan originated",
            "format": "date",
            "type": "string"
          },
          "portfolioIdentifier": {
            "description": "Unique identifier of the portfolio in which this Loan resides",
            "pattern": "[A-Z0-9]{8}",
            "type": "string"
          },
          "relatedDocuments": {
            "description": "Documents associated with the loan",
            "items": {
              "properties": {
                "documentName": {
                  "description": "Name of the document",
                  "type": "string"
                },
                "documentUri": {
                  "description": "Name of the document",
                  "format": "uri",
                  "type": "string"
                }
              },
              "type": "object"
            },
            "type": "array"
          },
          "securityIdentifier": {
            "description": "Unique identifier of the associated security",
            "pattern": "[A-Z0-9]{9}",
            "type": "string"
          },
          "unpaidPrincipalBalance": {
            "description": "Current unpaid principal balance amount",
            "type": "number"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "LoanPortfolio": {
      "description": "A collection of Loans along with metadata about the loans, modeled as a portfolio",
      "items": {
        "properties": {
          "delinquentPercent": {
            "description": "The percent of currently delinquent Loans in the Loan Portfolio",
            "type": "number"
          },
          "latePercent": {
            "description": "The percent of currently late Loans in the Loan Portfolio",
            "type": "number"
          },
          "portfolioIdentifier": {
            "description": "Unique identifier of this Loan Portfolio",
            "pattern": "[A-Z0-9]{8}",
            "type": "string"
          },
          "portfolioName": {
            "description": "Descriptive name of this Loan Portfolio",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "Payment": {
      "description": "Monthly payment information for a given Loan",
      "items": {
        "properties": {
          "effectiveDate": {
            "description": "Payment effective date",
            "format": "date",
            "type": "string"
          },
          "loanIdentifier": {
            "description": "Globally unique loan identifier, set by the original lender",
            "pattern": "[0-9]{16}",
            "type": "string"
          },
          "principalAndInterestPaymentAmount": {
            "description": "Payment amount, including principal and interest",
            "minimum": 0,
            "type": "number"
          },
          "principalDistributionAmount": {
            "description": "Amount from principalAndInterestPaymentAmount applied to principal",
            "minimum": 0,
            "type": "number"
          },
          "reportingPeriod": {
            "description": "Reporting period year month",
            "pattern": "[0-9]{4}-(0[1-9]|1[0-2])",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "SingleClassSecurity": {
      "description": "Single class (Level 1) securities, used to create a pool of Loans",
      "items": {
        "properties": {
          "issueAmount": {
            "description": "Issuance amount",
            "minimum": 0,
            "type": "integer"
          },
          "issueDate": {
            "description": "Issuance date",
            "format": "date",
            "type": "string"
          },
          "issuerIdentifier": {
            "description": "Unique identifier for the issuer",
            "pattern": "[0-9]{6}",
            "type": "string"
          },
          "maturityDate": {
            "description": "Maturity date",
            "format": "date",
            "type": "string"
          },
          "parMinimumAmount": {
            "description": "Par minimum amount",
            "minimum": 0,
            "type": "integer"
          },
          "poolIdentifier": {
            "description": "Unique identifier of the pool created by this L1 security",
            "pattern": "[A-Z0-9]{6}",
            "type": "string"
          },
          "securityIdentifier": {
            "description": "Unique identifier (CUSIP) of this L1 security",
            "pattern": "[A-Z0-9]{9}",
            "type": "string"
          },
          "trustIdentifier": {
            "description": "Unique identifier for the trust",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    }
  },
  "title": "Complete Loan Platform",
  "type": "object",
  "x-vendia-acls": {
    "DisclosureAcl": {
      "type": "Disclosure"
    },
    "LoanAcl": {
      "type": "Loan"
    },
    "LoanPortfolioAcl": {
      "type": "LoanPortfolio"
    },
    "PaymentAcl": {
      "type": "Payment"
    },
    "SingleClassSecurityAcl": {
      "type": "SingleClassSecurity"
    }
  }
}