{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/averray-com/json-schema/averray-com-job-preflight-response-schema.json",
  "title": "JobPreflightResponse",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/averray-com-openapi.json#/components/schemas/JobPreflightResponse",
  "type": "object",
  "required": [
    "wallet",
    "jobId",
    "eligible",
    "claimStake",
    "claimFee",
    "totalClaimLock",
    "strategyUnwindNeeded",
    "failureStates"
  ],
  "properties": {
    "wallet": {
      "type": "string",
      "pattern": "^0x[a-fA-F0-9]{40}$"
    },
    "jobId": {
      "type": "string"
    },
    "eligible": {
      "type": "boolean",
      "description": "True only when the job is claimable for this wallet and its liquid position covers the projected claim lock."
    },
    "catalogEligible": {
      "type": "boolean",
      "description": "Whether lifecycle, tier, role, and verifier gates pass before wallet claim-funding is considered."
    },
    "netReward": {
      "type": "number"
    },
    "availableLiquidity": {
      "type": "number"
    },
    "claimStake": {
      "type": "number"
    },
    "claimStakeBps": {
      "type": "integer"
    },
    "claimFee": {
      "type": "number"
    },
    "claimFeeBps": {
      "type": "integer"
    },
    "claimEconomicsWaived": {
      "type": "boolean"
    },
    "claimEconomicsWaiverScope": {
      "type": "string"
    },
    "onboardingSubsidy": {
      "type": "object",
      "description": "Global UTC-day onboarding budget snapshot. `applies` is true for every operator-brokered claim: all consume estimated gas, while genuine tier-0 waivers also consume waived stake. The aggregate is intentionally not wallet-scoped.",
      "properties": {
        "scope": {
          "type": "string"
        },
        "day": {
          "type": "string",
          "format": "date"
        },
        "clock": {
          "type": "string",
          "const": "UTC"
        },
        "resetAt": {
          "type": "string",
          "format": "date-time"
        },
        "dailyBudgetUsdc": {
          "type": "number",
          "minimum": 0
        },
        "allocatedUsdc": {
          "type": "number",
          "minimum": 0
        },
        "headroomUsdc": {
          "type": "number",
          "minimum": 0
        },
        "applies": {
          "type": "boolean"
        },
        "available": {
          "type": "boolean"
        },
        "estimatedClaimSubsidyUsdc": {
          "type": "number",
          "minimum": 0
        }
      },
      "additionalProperties": true
    },
    "claimNumber": {
      "type": "integer"
    },
    "totalClaimLock": {
      "type": "number"
    },
    "claimFundingAsset": {
      "type": "string",
      "description": "Settlement asset used by the liquidity and shortfall fields."
    },
    "claimFundingSufficient": {
      "type": "boolean",
      "description": "Whether availableLiquidity covers totalClaimLock."
    },
    "claimFundingShortfall": {
      "type": "number",
      "minimum": 0,
      "description": "Additional liquid balance required to cover totalClaimLock."
    },
    "reason": {
      "type": "string",
      "description": "Machine-readable claimability reason, including `insufficient_liquidity` or `onboarding_subsidy_exhausted`."
    },
    "reasonMessage": {
      "type": "string",
      "description": "Actionable human-readable detail for a claimability reason, including the self-funded path when the operator-brokered subsidy is exhausted."
    },
    "strategyUnwindNeeded": {
      "type": "boolean"
    },
    "requiredOutputSchema": {
      "type": "string",
      "description": "Schema reference that validates `payload.submission`."
    },
    "submissionContract": {
      "$ref": "#/$defs/SubmissionContract"
    },
    "verificationContract": {
      "type": "object",
      "additionalProperties": true
    },
    "verifierMode": {
      "type": "string"
    },
    "verifierConfig": {
      "type": "object",
      "additionalProperties": true
    },
    "tier": {
      "type": "string"
    },
    "lifecycle": {
      "$ref": "#/$defs/JobLifecycle"
    },
    "tierGate": {
      "type": "object",
      "additionalProperties": true
    },
    "jobType": {
      "type": "string"
    },
    "requiredRole": {
      "type": "string"
    },
    "roleGate": {
      "type": "object",
      "additionalProperties": true
    },
    "failureStates": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "additionalProperties": true,
  "$defs": {
    "JobLifecycle": {
      "type": "object",
      "required": [
        "status",
        "state"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "open",
            "paused",
            "archived",
            "closed",
            "cancelled"
          ]
        },
        "state": {
          "type": "string",
          "enum": [
            "open",
            "stale",
            "paused",
            "archived",
            "closed",
            "cancelled"
          ]
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "staleAt": {
          "type": "string",
          "format": "date-time"
        },
        "reason": {
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "JobSubmissionRequest": {
      "type": "object",
      "required": [
        "sessionId",
        "submission"
      ],
      "properties": {
        "sessionId": {
          "type": "string",
          "minLength": 1
        },
        "submission": {
          "type": "object",
          "description": "The job's output-schema object directly. This object is validated against the claimed job's `outputSchemaRef`; do not add an `output` wrapper.",
          "additionalProperties": true
        }
      },
      "additionalProperties": false
    },
    "SubmissionContract": {
      "type": "object",
      "required": [
        "endpoint",
        "validationEndpoint",
        "submissionShape",
        "structuredSubmissionRequired",
        "schemaValidates",
        "doNotWrapInOutput",
        "outputSchemaRef",
        "submitPayloadExample"
      ],
      "properties": {
        "endpoint": {
          "type": "string",
          "const": "POST /jobs/submit"
        },
        "validationEndpoint": {
          "type": "string",
          "const": "POST /jobs/validate-submission"
        },
        "submissionShape": {
          "type": "string",
          "const": "direct_schema_object"
        },
        "structuredSubmissionRequired": {
          "type": "boolean",
          "const": true
        },
        "schemaValidates": {
          "type": "string",
          "const": "payload.submission"
        },
        "doNotWrapInOutput": {
          "type": "boolean",
          "const": true
        },
        "compatibilityAliases": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "outputSchemaRef": {
          "type": "string"
        },
        "outputSchemaUrl": {
          "type": [
            "string",
            "null"
          ]
        },
        "submitPayloadExample": {
          "$ref": "#/$defs/JobSubmissionRequest"
        },
        "invalidWrappedOutputHint": {
          "type": "string"
        }
      },
      "additionalProperties": true
    }
  }
}