{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/specstream-ai/json-schema/specstream-ai-capacity-partner-report-data-schema.json",
  "title": "CapacityPartnerReportData",
  "description": "A partner's own numbers: its link and terms, the totals and each month, newest first.\n\nsignups are the accounts made through the link and accounts the ones that confirmed their\nemail. earned_cents is net of refunds; pending_cents is still in its clearing days,\nowed_cents has cleared and is not paid yet, paid_cents was paid out (less what a later payout\nrecovered), open_debt_cents is what refunds took back after a payout and the next payout\nrecovers, and payable_cents is that next payout: owed_cents less open_debt_cents, never below\nzero. Each month and, over every page, the referred accounts add up to these figures.\nreferred_accounts is one page, newest sign-up first; referred_accounts_next is the after\ncursor of the next page, None after the last. referred_accounts is None for a reader who is\nnot the account's owner or an application allowed to manage it.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/specstream-ai-openapi.json#/components/schemas/CapacityPartnerReportData",
  "additionalProperties": false,
  "properties": {
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Name"
    },
    "code": {
      "title": "Code",
      "type": "string"
    },
    "link": {
      "title": "Link",
      "type": "string"
    },
    "share_percent": {
      "minimum": 1,
      "title": "Share Percent",
      "type": "integer"
    },
    "share_bps": {
      "maximum": 10000,
      "minimum": 1,
      "title": "Share Bps",
      "type": "integer"
    },
    "months": {
      "minimum": 1,
      "title": "Months",
      "type": "integer"
    },
    "active": {
      "title": "Active",
      "type": "boolean"
    },
    "clearing_days": {
      "minimum": 0,
      "title": "Clearing Days",
      "type": "integer"
    },
    "yearly_clearing_days": {
      "minimum": 0,
      "title": "Yearly Clearing Days",
      "type": "integer"
    },
    "signups": {
      "minimum": 0,
      "title": "Signups",
      "type": "integer"
    },
    "accounts": {
      "minimum": 0,
      "title": "Accounts",
      "type": "integer"
    },
    "paying_accounts": {
      "minimum": 0,
      "title": "Paying Accounts",
      "type": "integer"
    },
    "payments": {
      "minimum": 0,
      "title": "Payments",
      "type": "integer"
    },
    "earned_cents": {
      "minimum": 0,
      "title": "Earned Cents",
      "type": "integer"
    },
    "pending_cents": {
      "minimum": 0,
      "title": "Pending Cents",
      "type": "integer"
    },
    "owed_cents": {
      "minimum": 0,
      "title": "Owed Cents",
      "type": "integer"
    },
    "paid_cents": {
      "minimum": 0,
      "title": "Paid Cents",
      "type": "integer"
    },
    "open_debt_cents": {
      "minimum": 0,
      "title": "Open Debt Cents",
      "type": "integer"
    },
    "payable_cents": {
      "minimum": 0,
      "title": "Payable Cents",
      "type": "integer"
    },
    "by_month": {
      "items": {
        "$ref": "#/$defs/CapacityPartnerMonthData"
      },
      "title": "By Month",
      "type": "array"
    },
    "referred_accounts": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/CapacityPartnerAccountData"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Referred Accounts"
    },
    "referred_accounts_next": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Referred Accounts Next"
    }
  },
  "required": [
    "code",
    "link",
    "share_percent",
    "share_bps",
    "months",
    "active",
    "clearing_days",
    "yearly_clearing_days",
    "signups",
    "accounts",
    "paying_accounts",
    "payments",
    "earned_cents",
    "pending_cents",
    "owed_cents",
    "paid_cents",
    "open_debt_cents",
    "payable_cents",
    "by_month"
  ],
  "type": "object",
  "$defs": {
    "CapacityPartnerAccountData": {
      "additionalProperties": false,
      "description": "One account a partner brought. reference is stable and names the account only inside this\npartner's report; no email, name, domain or account id is shown. The partner earns on its\npayments from term_start until term_end (dates, UTC).",
      "properties": {
        "reference": {
          "title": "Reference",
          "type": "string"
        },
        "signed_up_month": {
          "pattern": "^\\d{4}-\\d{2}$",
          "title": "Signed Up Month",
          "type": "string"
        },
        "term_start": {
          "title": "Term Start",
          "type": "string"
        },
        "term_end": {
          "title": "Term End",
          "type": "string"
        },
        "in_term": {
          "title": "In Term",
          "type": "boolean"
        },
        "by_month": {
          "items": {
            "$ref": "#/$defs/CapacityPartnerAccountMonthData"
          },
          "title": "By Month",
          "type": "array"
        }
      },
      "required": [
        "reference",
        "signed_up_month",
        "term_start",
        "term_end",
        "in_term",
        "by_month"
      ],
      "title": "CapacityPartnerAccountData",
      "type": "object"
    },
    "CapacityPartnerAccountMonthData": {
      "additionalProperties": false,
      "description": "One calendar month (UTC) of settled payments of one referred account.\n\npayment_cents is what its payments counted for (before tax, inside the term), share_cents the\npartner's share of it. Of the share, pending_cents is still in its clearing days, owed_cents\nhas cleared and is not paid yet, paid_cents was paid out (less what a later payout already\nrecovered), open_debt_cents a refund or a dispute took back from paid_cents after the payout\nand the next payout still recovers, taken_back_cents all a refund or a dispute took back.\nstate names the one of pending, owed or paid that holds money, mixed when more than one\ndoes, taken_back when a refund or dispute took all of it. Over every account, each figure\nadds up to the report's figure of the same name.",
      "properties": {
        "month": {
          "pattern": "^\\d{4}-\\d{2}$",
          "title": "Month",
          "type": "string"
        },
        "payment_cents": {
          "minimum": 0,
          "title": "Payment Cents",
          "type": "integer"
        },
        "share_cents": {
          "minimum": 0,
          "title": "Share Cents",
          "type": "integer"
        },
        "pending_cents": {
          "minimum": 0,
          "title": "Pending Cents",
          "type": "integer"
        },
        "owed_cents": {
          "minimum": 0,
          "title": "Owed Cents",
          "type": "integer"
        },
        "paid_cents": {
          "minimum": 0,
          "title": "Paid Cents",
          "type": "integer"
        },
        "open_debt_cents": {
          "minimum": 0,
          "title": "Open Debt Cents",
          "type": "integer"
        },
        "taken_back_cents": {
          "minimum": 0,
          "title": "Taken Back Cents",
          "type": "integer"
        },
        "state": {
          "enum": [
            "pending",
            "owed",
            "paid",
            "mixed",
            "taken_back",
            "none"
          ],
          "title": "State",
          "type": "string"
        }
      },
      "required": [
        "month",
        "payment_cents",
        "share_cents",
        "pending_cents",
        "owed_cents",
        "paid_cents",
        "open_debt_cents",
        "taken_back_cents",
        "state"
      ],
      "title": "CapacityPartnerAccountMonthData",
      "type": "object"
    },
    "CapacityPartnerMonthData": {
      "additionalProperties": false,
      "description": "One calendar month (UTC) of what a partner brought.",
      "properties": {
        "month": {
          "pattern": "^\\d{4}-\\d{2}$",
          "title": "Month",
          "type": "string"
        },
        "signups": {
          "minimum": 0,
          "title": "Signups",
          "type": "integer"
        },
        "accounts": {
          "minimum": 0,
          "title": "Accounts",
          "type": "integer"
        },
        "paying_accounts": {
          "minimum": 0,
          "title": "Paying Accounts",
          "type": "integer"
        },
        "payments": {
          "minimum": 0,
          "title": "Payments",
          "type": "integer"
        },
        "payment_cents": {
          "minimum": 0,
          "title": "Payment Cents",
          "type": "integer"
        },
        "earned_cents": {
          "minimum": 0,
          "title": "Earned Cents",
          "type": "integer"
        },
        "pending_cents": {
          "minimum": 0,
          "title": "Pending Cents",
          "type": "integer"
        },
        "owed_cents": {
          "minimum": 0,
          "title": "Owed Cents",
          "type": "integer"
        },
        "paid_cents": {
          "minimum": 0,
          "title": "Paid Cents",
          "type": "integer"
        },
        "open_debt_cents": {
          "minimum": 0,
          "title": "Open Debt Cents",
          "type": "integer"
        }
      },
      "required": [
        "month",
        "signups",
        "accounts",
        "paying_accounts",
        "payments",
        "payment_cents",
        "earned_cents",
        "pending_cents",
        "owed_cents",
        "paid_cents",
        "open_debt_cents"
      ],
      "title": "CapacityPartnerMonthData",
      "type": "object"
    }
  }
}