{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/averray-com/json-schema/averray-com-job-schema.json",
  "title": "Job",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/averray-com-openapi.json#/components/schemas/Job",
  "type": "object",
  "required": [
    "id",
    "title",
    "jobType",
    "requiredRole",
    "category",
    "tier"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "jobType": {
      "type": "string"
    },
    "requiredRole": {
      "type": "string"
    },
    "category": {
      "type": "string"
    },
    "tier": {
      "type": "string"
    },
    "rewardAsset": {
      "type": "string"
    },
    "rewardAmount": {
      "type": "number"
    },
    "source": {
      "type": "object",
      "additionalProperties": true
    },
    "publicDetails": {
      "$ref": "#/$defs/WikipediaPublicJobDetails"
    },
    "lifecycle": {
      "$ref": "#/$defs/JobLifecycle"
    },
    "claimStatus": {
      "$ref": "#/$defs/JobClaimStatus"
    },
    "claimabilitySource": {
      "type": "string",
      "const": "claimStatus"
    },
    "listedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When this job first entered the catalogue; stable across reads."
    },
    "lifecycleStatusMeaning": {
      "type": "string"
    }
  },
  "additionalProperties": true,
  "$defs": {
    "JobClaimStatus": {
      "type": "object",
      "description": "Authoritative current claimability state for agents. Use this before mutating /jobs/claim; lifecycle.status is content/job lifecycle metadata.",
      "properties": {
        "claimState": {
          "type": "string",
          "enum": [
            "open",
            "claimed",
            "expired",
            "submitted",
            "disputed",
            "rejected",
            "restricted",
            "unclaimable",
            "closed",
            "cancelled",
            "paused",
            "archived",
            "stale",
            "exhausted"
          ]
        },
        "state": {
          "type": "string"
        },
        "effectiveState": {
          "type": "string",
          "enum": [
            "claimable",
            "claimed",
            "expired",
            "submitted",
            "disputed",
            "rejected",
            "restricted",
            "unclaimable",
            "closed",
            "cancelled",
            "paused",
            "archived",
            "stale",
            "exhausted"
          ]
        },
        "claimable": {
          "type": "boolean"
        },
        "fundingState": {
          "type": "string",
          "enum": [
            "funded",
            "available",
            "unavailable",
            "pending",
            "unverified",
            "not_checked"
          ],
          "description": "Funded is recorded prefunding; available is current shared reward-bank headroom for a claimable job, not an earmark. Unavailable means funds are not available for a new claim. not_checked asserts no funding evidence."
        },
        "currentWalletCanClaim": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "reason": {
          "type": "string"
        },
        "retryLimit": {
          "type": "integer",
          "description": "Maximum delivered submissions or terminal submit-revert attempts before the job is exhausted. A no-show claim that expires without any submit attempt does not count."
        },
        "claimAttemptCount": {
          "type": "integer",
          "description": "Delivered submission attempts counted against retryLimit; excludes unsubmitted expired claims."
        },
        "remainingClaimAttempts": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Delivered submission attempts remaining, or null when retryLimit is unlimited."
        },
        "claimedBy": {
          "type": [
            "string",
            "null"
          ]
        },
        "claimedAt": {
          "type": [
            "string",
            "null"
          ]
        },
        "claimExpiresAt": {
          "type": [
            "string",
            "null"
          ]
        },
        "claimabilitySource": {
          "type": "string",
          "const": "claimStatus"
        },
        "lifecycleStatusMeaning": {
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "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
    },
    "WikipediaPublicJobDetails": {
      "type": "object",
      "properties": {
        "jobId": {
          "type": "string"
        },
        "source": {
          "type": "string",
          "const": "wikipedia"
        },
        "taskType": {
          "type": "string"
        },
        "pageTitle": {
          "type": "string"
        },
        "lang": {
          "type": "string"
        },
        "revisionId": {
          "type": "string"
        },
        "articleUrl": {
          "type": "string"
        },
        "pinnedRevisionUrl": {
          "type": "string"
        },
        "acceptanceCriteria": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "outputSchemaRef": {
          "type": "string"
        },
        "outputSchemaUrl": {
          "type": "string"
        },
        "proposalOnly": {
          "type": "boolean"
        },
        "attributionPolicy": {
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  }
}