{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cavuno-com/json-schema/cavuno-com-company-routing-rule-preview-schema.json",
  "title": "CompanyRoutingRulePreview",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cavuno-com-companies-api-openapi.yml#/components/schemas/CompanyRoutingRulePreview",
  "type": "object",
  "properties": {
    "object": {
      "type": "string",
      "enum": [
        "company_routing_rule_preview"
      ]
    },
    "jobs": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The job id."
          },
          "title": {
            "type": "string"
          },
          "locationLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "companyLocked": {
            "type": "boolean",
            "description": "Moved to its company by hand: listed, never moved by a rule."
          },
          "reason": {
            "$ref": "#/$defs/CompanyRoutingMatchReason"
          },
          "claimedBy": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "ruleId": {
                "type": "string"
              },
              "targetName": {
                "type": "string"
              }
            },
            "required": [
              "ruleId",
              "targetName"
            ],
            "description": "An earlier rule that already routes this job."
          }
        },
        "required": [
          "id",
          "title",
          "locationLabel",
          "companyLocked",
          "reason",
          "claimedBy"
        ]
      },
      "description": "Up to 5 of the parent's newest published jobs the draft rule matches."
    },
    "hasMore": {
      "type": "boolean",
      "description": "True when more jobs match than `jobs` lists."
    },
    "scanCapped": {
      "type": "boolean",
      "description": "True when the check stopped at the parent's 200 newest published jobs before finding more than 5 matches. Older jobs were not checked."
    },
    "moveCount": {
      "type": "number",
      "deprecated": true,
      "description": "Deprecated: the jobs in `jobs` that `moveExistingJobs` would move (not locked, not claimed by an earlier rule), so at most 5. `moveExistingJobs` moves every match; read `movedJobCount` on the save result."
    },
    "truncated": {
      "type": "boolean",
      "deprecated": true,
      "description": "Deprecated: use `hasMore` and `scanCapped`. True when either is true."
    }
  },
  "required": [
    "object",
    "jobs",
    "hasMore",
    "scanCapped",
    "moveCount",
    "truncated"
  ],
  "$defs": {
    "CompanyRoutingMatchReason": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "condition"
              ]
            },
            "field": {
              "type": "string",
              "enum": [
                "application_url",
                "title",
                "description"
              ]
            },
            "term": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "field",
            "term"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "all_conditions"
              ]
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "location"
              ]
            },
            "placeName": {
              "type": "string"
            }
          },
          "required": [
            "kind"
          ]
        },
        {}
      ],
      "description": "Why the job matched."
    }
  }
}