{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/affiliaterail-com/json-schema/affiliaterail-com-payout-batch-run-schema.json",
  "title": "PayoutBatchRun",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/affiliaterail-com-payout-batches-api-openapi.yml#/components/schemas/PayoutBatchRun",
  "type": "object",
  "properties": {
    "object": {
      "type": "string",
      "enum": [
        "payout_batch_run"
      ]
    },
    "batches": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PayoutBatch"
      }
    },
    "created": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "payout_id": {
            "type": "string",
            "pattern": "^(sample_)?pyt_",
            "description": "Prefixed id (`pyt_…`)"
          },
          "partner_id": {
            "type": "string",
            "pattern": "^(sample_)?part_",
            "description": "Prefixed id (`part_…`)"
          },
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "description": "ISO-4217"
          },
          "amount_minor": {
            "type": "integer",
            "description": "Integer minor units (cents, pence). Never a float, never a string."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "not_eligible"
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "payout_id",
          "partner_id",
          "currency",
          "amount_minor",
          "status",
          "reason"
        ]
      }
    },
    "upgraded": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^(sample_)?pyt_",
        "description": "Prefixed id (`pyt_…`)"
      }
    },
    "refreshed": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^(sample_)?pyt_",
        "description": "Prefixed id (`pyt_…`)"
      }
    },
    "skipped": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "partner_id": {
            "type": "string",
            "pattern": "^(sample_)?part_",
            "description": "Prefixed id (`part_…`)"
          },
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3,
            "description": "ISO-4217"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "partner_id",
          "currency",
          "status"
        ]
      }
    }
  },
  "required": [
    "object",
    "batches",
    "created",
    "upgraded",
    "refreshed",
    "skipped"
  ],
  "$defs": {
    "PayoutBatch": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^(sample_)?batch_",
          "description": "Prefixed id (`batch_…`)"
        },
        "object": {
          "type": "string",
          "enum": [
            "payout_batch"
          ]
        },
        "program_id": {
          "type": "string",
          "pattern": "^(sample_)?prg_",
          "description": "Prefixed id (`prg_…`)"
        },
        "term": {
          "type": "string",
          "enum": [
            "net_15",
            "net_30",
            "net_60"
          ]
        },
        "period_start": {
          "type": "string",
          "format": "date-time",
          "description": "ISO-8601, UTC"
        },
        "period_end": {
          "type": "string",
          "format": "date-time",
          "description": "ISO-8601, UTC"
        },
        "currency": {
          "type": "string",
          "minLength": 3,
          "maxLength": 3,
          "description": "ISO-4217"
        },
        "total_minor": {
          "type": "integer",
          "description": "Integer minor units (cents, pence). Never a float, never a string."
        },
        "payout_count": {
          "type": "integer"
        },
        "generated_by_user_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "executed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "ISO-8601, UTC"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "ISO-8601, UTC"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "description": "ISO-8601, UTC"
        }
      },
      "required": [
        "id",
        "object",
        "program_id",
        "term",
        "period_start",
        "period_end",
        "currency",
        "total_minor",
        "payout_count",
        "generated_by_user_id",
        "executed_at",
        "created_at",
        "updated_at"
      ]
    }
  }
}