{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/affiliatebase-io/json-schema/affiliatebase-io-affiliate-schema.json",
  "title": "Affiliate",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/affiliatebase-io-openapi.yml#/components/schemas/Affiliate",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "email": {
      "type": "string"
    },
    "first_name": {
      "type": "string"
    },
    "last_name": {
      "type": "string"
    },
    "state": {
      "$ref": "#/$defs/AffiliateState"
    },
    "banned_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the affiliate was banned; `null` unless `state` is `banned`."
    },
    "ban_reason": {
      "oneOf": [
        {
          "$ref": "#/$defs/AffiliateBanReason"
        },
        {
          "type": "null"
        }
      ],
      "description": "The ban reason; `null` unless `state` is `banned`."
    },
    "paypal_email": {
      "type": "string"
    },
    "wise_email": {
      "type": "string"
    }
  },
  "$defs": {
    "AffiliateBanReason": {
      "type": "string",
      "enum": [
        "fraud",
        "fake_traffic",
        "self_referral",
        "tos_violation",
        "brand_abuse",
        "spam",
        "other"
      ]
    },
    "AffiliateState": {
      "type": "string",
      "enum": [
        "pending",
        "active",
        "disabled",
        "suspicious",
        "rejected",
        "banned"
      ],
      "description": "`banned` is entered and left only through the ban and unban endpoints.\n"
    }
  }
}