{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/financegenius-ai/json-schema/financegenius-ai-app-api-v1-crm-payouts-terms-in-schema.json",
  "title": "TermsIn",
  "x-generated": "2026-11-07",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/financegenius-ai-openapi.json#/components/schemas/app__api__v1__crm_payouts__TermsIn",
  "properties": {
    "lender_code": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]{1,39}$",
      "title": "Lender Code"
    },
    "product": {
      "type": "string",
      "maxLength": 40,
      "title": "Product"
    },
    "effective_from": {
      "type": "string",
      "format": "date",
      "title": "Effective From"
    },
    "basis_kind": {
      "type": "string",
      "enum": [
        "rate",
        "flat"
      ],
      "title": "Basis Kind"
    },
    "rate_bps": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Rate Bps"
    },
    "flat_paise": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Flat Paise"
    },
    "payout_basis": {
      "type": "string",
      "enum": [
        "gross",
        "net"
      ],
      "title": "Payout Basis",
      "default": "gross"
    },
    "slab_period": {
      "type": "string",
      "enum": [
        "none",
        "monthly",
        "quarterly"
      ],
      "title": "Slab Period",
      "default": "none"
    },
    "slab_measure": {
      "type": "string",
      "enum": [
        "volume",
        "count"
      ],
      "title": "Slab Measure",
      "default": "volume"
    },
    "slab_mode": {
      "type": "string",
      "enum": [
        "retroactive",
        "incremental"
      ],
      "title": "Slab Mode",
      "default": "retroactive"
    },
    "slab_net_of_clawbacks": {
      "type": "boolean",
      "title": "Slab Net Of Clawbacks",
      "default": true
    },
    "slabs": {
      "items": {
        "$ref": "#/$defs/SlabIn"
      },
      "type": "array",
      "maxItems": 12,
      "title": "Slabs"
    },
    "tranche_policy": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "per_tranche",
            "first",
            "full"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Tranche Policy"
    },
    "ownership_window_days": {
      "type": "integer",
      "maximum": 365.0,
      "minimum": 0.0,
      "title": "Ownership Window Days"
    },
    "dedupe_outcome": {
      "type": "string",
      "enum": [
        "no_payout",
        "reduced",
        "full"
      ],
      "title": "Dedupe Outcome"
    },
    "dedupe_reduced_share_bps": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Dedupe Reduced Share Bps"
    },
    "card_trigger": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "approval",
            "issue",
            "activation",
            "first_spend"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Card Trigger"
    },
    "card_window_days": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Card Window Days"
    },
    "clawback_rules": {
      "items": {
        "$ref": "#/$defs/ClawbackIn"
      },
      "type": "array",
      "maxItems": 5,
      "title": "Clawback Rules"
    },
    "repeat_window_months": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Repeat Window Months"
    }
  },
  "type": "object",
  "required": [
    "lender_code",
    "product",
    "effective_from",
    "basis_kind",
    "ownership_window_days",
    "dedupe_outcome"
  ],
  "$defs": {
    "ClawbackIn": {
      "properties": {
        "trigger": {
          "type": "string",
          "enum": [
            "cooling_off_exit",
            "cancellation",
            "foreclosure",
            "early_bounce",
            "early_default"
          ],
          "title": "Trigger"
        },
        "window_days": {
          "type": "integer",
          "maximum": 730.0,
          "minimum": 1.0,
          "title": "Window Days"
        },
        "share_bps": {
          "type": "integer",
          "maximum": 10000.0,
          "minimum": 1.0,
          "title": "Share Bps",
          "default": 10000
        }
      },
      "type": "object",
      "required": [
        "trigger",
        "window_days"
      ],
      "title": "ClawbackIn"
    },
    "SlabIn": {
      "properties": {
        "threshold": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Threshold"
        },
        "rate_bps": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Rate Bps"
        },
        "flat_paise": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Flat Paise"
        }
      },
      "type": "object",
      "required": [
        "threshold"
      ],
      "title": "SlabIn"
    }
  }
}