{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openassignment.io/schemas/v0.1/schema.json",
  "title": "OpenAssignment assignment",
  "description": "A consulting assignment: a defined piece of work a company wants to buy from a consultant or consulting company, published by that company at the source. Not an employment. Draft specification 0.1. Unknown fields are allowed and must be ignored by consumers.",
  "type": "object",
  "required": [
    "schemaVersion",
    "id",
    "canonicalUrl",
    "title",
    "description",
    "publisher",
    "status",
    "publishedAt",
    "updatedAt"
  ],
  "properties": {
    "$schema": {
      "type": "string",
      "format": "uri",
      "description": "URL of the schema this document follows."
    },
    "schemaVersion": {
      "type": "string",
      "pattern": "^0\\.1\\.(0|[1-9][0-9]*)$",
      "description": "Version of OpenAssignment the document follows, for example \"0.1.0\"."
    },
    "id": {
      "type": "string",
      "minLength": 1,
      "description": "Stable identifier of the assignment, unique within the publisher. Must never change or be reused, even if the title or the file name changes. A UUID URN is recommended."
    },
    "canonicalUrl": {
      "type": "string",
      "format": "uri",
      "description": "The source address: the permanent URL of this JSON document on the publisher's own domain. Every service that presents the assignment links back to it."
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "description": "Title of the assignment, normally the role that is needed."
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "description": "What the work is: background, tasks and expected outcome. Plain text. Line breaks separate paragraphs."
    },
    "publisher": {
      "$ref": "#/$defs/organization",
      "description": "The organisation that publishes and maintains the assignment on its own domain. Normally the company that needs the work. The publisher is the source of the information."
    },
    "client": {
      "$ref": "#/$defs/organization",
      "description": "The organisation where the work is done, when that is not the publisher. Leave out when the publisher is the client."
    },
    "facilitator": {
      "$ref": "#/$defs/facilitator",
      "description": "An agency or other intermediary that helps fill the assignment, for example by sourcing, qualifying or contracting consultants. Optional. A facilitator is not the source of the information: the publisher is."
    },
    "requiredSkills": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/skill"
      },
      "description": "Skills a consultant must have."
    },
    "preferredSkills": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/skill"
      },
      "description": "Skills that count in a consultant's favour but are not mandatory."
    },
    "location": {
      "$ref": "#/$defs/place",
      "description": "Where on-site work takes place."
    },
    "remote": {
      "enum": [
        "onsite",
        "hybrid",
        "remote"
      ],
      "description": "Way of working. `onsite`: at the client. `hybrid`: a mix of on-site and remote. `remote`: fully remote."
    },
    "engagementType": {
      "enum": [
        "full-time",
        "part-time",
        "project"
      ],
      "description": "Form of the assignment. `full-time` and `part-time` are engagements paid by time. `project` is a delivery with a defined scope."
    },
    "workload": {
      "type": "object",
      "description": "How much work the assignment is.",
      "properties": {
        "percent": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "description": "Share of full time, in percent."
        },
        "hoursPerWeek": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Expected hours per week."
        },
        "description": {
          "type": "string",
          "description": "Free text for anything the numbers do not capture."
        }
      }
    },
    "startDate": {
      "type": "string",
      "format": "date",
      "description": "Expected first day of the assignment."
    },
    "endDate": {
      "type": "string",
      "format": "date",
      "description": "Expected last day, if known."
    },
    "status": {
      "enum": [
        "open",
        "paused",
        "filled",
        "closed"
      ],
      "description": "`open`: accepting interest. `paused`: temporarily not accepting interest. `filled`: a consultant has been appointed. `closed`: withdrawn or ended without being filled."
    },
    "publishedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the assignment was first published."
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the assignment last changed, including changes of status."
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time",
      "description": "After this moment the assignment must no longer be presented as open, whatever `status` says."
    },
    "applicationUrl": {
      "type": "string",
      "format": "uri",
      "description": "Where to register interest: a web page or a `mailto:` address, at the publisher or at the facilitator."
    },
    "htmlUrl": {
      "type": "string",
      "format": "uri",
      "description": "URL of the human readable page at the publisher showing the same assignment."
    }
  },
  "$defs": {
    "organization": {
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "description": "Name of the organisation."
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "The organisation's website."
        }
      }
    },
    "place": {
      "type": "object",
      "properties": {
        "city": {
          "type": "string",
          "description": "City or town."
        },
        "region": {
          "type": "string",
          "description": "Region, county or state."
        },
        "countryCode": {
          "type": "string",
          "pattern": "^[A-Z]{2}$",
          "description": "ISO 3166-1 alpha-2 country code, for example \"SE\"."
        }
      }
    },
    "skill": {
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "description": "Name of the skill."
        },
        "level": {
          "type": "string",
          "description": "Expected level, for example \"Senior\"."
        },
        "keywords": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Specific technologies, methods or tools within the skill."
        }
      }
    },
    "facilitator": {
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "description": "Name of the facilitating organisation."
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "The facilitator's website."
        },
        "role": {
          "type": "string",
          "description": "What the facilitator does for this assignment, in a sentence."
        }
      }
    }
  }
}
