{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://themwdesk.com/schemas/jobs.schema.json",
  "title": "The MW Desk public jobs feed",
  "description": "Public, permissioned records only. No worker profiles, private contacts, precise asset addresses, payment credentials, or confidential material.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "schema_version": {
      "const": "1.0"
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "source_updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "status": {
      "enum": [
        "empty",
        "snapshot"
      ]
    },
    "note": {
      "type": "string"
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]+$"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "employer": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "name": {
                "type": "string"
              },
              "website": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              }
            },
            "required": [
              "name",
              "website"
            ]
          },
          "market": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "city": {
                "type": "string"
              },
              "region": {
                "type": "string"
              },
              "country": {
                "type": "string",
                "pattern": "^[A-Z]{2}$"
              }
            },
            "required": [
              "city",
              "region",
              "country"
            ]
          },
          "trade": {
            "type": "string"
          },
          "employment_type": {
            "type": "array",
            "minItems": 1,
            "items": {
              "enum": [
                "FULL_TIME",
                "PART_TIME",
                "CONTRACTOR",
                "TEMPORARY",
                "OTHER"
              ]
            }
          },
          "posted_at": {
            "type": "string",
            "format": "date"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "start_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "duration_text": {
            "type": "string"
          },
          "compensation": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "unit": {
                "enum": [
                  "HOUR",
                  "DAY",
                  "WEEK",
                  "MONTH",
                  "YEAR"
                ]
              },
              "minimum": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0
              },
              "maximum": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0
              },
              "employer_provided": {
                "type": "boolean"
              }
            },
            "required": [
              "currency",
              "unit",
              "minimum",
              "maximum",
              "employer_provided"
            ]
          },
          "per_diem": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "status": {
                "enum": [
                  "provided",
                  "none",
                  "not_disclosed"
                ]
              },
              "amount": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0
              },
              "currency": {
                "type": "string"
              },
              "eligibility": {
                "type": "string"
              }
            },
            "required": [
              "status",
              "amount",
              "currency",
              "eligibility"
            ]
          },
          "housing": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "status": {
                "enum": [
                  "employer_provided",
                  "allowance",
                  "worker_arranged",
                  "not_disclosed"
                ]
              },
              "details": {
                "type": "string"
              }
            },
            "required": [
              "status",
              "details"
            ]
          },
          "travel": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "rotation": {
                "type": "string"
              },
              "reimbursement": {
                "type": "string"
              }
            },
            "required": [
              "rotation",
              "reimbursement"
            ]
          },
          "apply_url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          },
          "direct_apply": {
            "type": "boolean"
          },
          "source": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "name": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              },
              "publication_rights": {
                "enum": [
                  "employer_permission",
                  "owner_permission",
                  "licensed_feed",
                  "original_reporting"
                ]
              }
            },
            "required": [
              "name",
              "url",
              "publication_rights"
            ]
          },
          "last_verified_at": {
            "type": "string",
            "format": "date-time"
          },
          "publication_status": {
            "const": "active"
          },
          "featured": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "url",
          "title",
          "description",
          "employer",
          "market",
          "trade",
          "employment_type",
          "posted_at",
          "expires_at",
          "start_date",
          "duration_text",
          "compensation",
          "per_diem",
          "housing",
          "travel",
          "apply_url",
          "direct_apply",
          "source",
          "last_verified_at",
          "publication_status",
          "featured"
        ]
      }
    }
  },
  "required": [
    "schema_version",
    "generated_at",
    "source_updated_at",
    "status",
    "note",
    "items"
  ],
  "allOf": [
    {
      "if": {
        "properties": {
          "status": {
            "const": "empty"
          }
        }
      },
      "then": {
        "properties": {
          "items": {
            "maxItems": 0
          }
        }
      }
    }
  ]
}
