{
  "name": "ServiceRequest",
  "description": "A request for work at a place: collecting bulky or disaster waste, a delivery, a repair, an inspection. It says what (items and how many), where, and when (time windows, and how much the requester needs that day), with the service time, the amount and the skills it needs, so it maps directly to a job of route optimisation (VRP) software. It holds no name or contact of the requester; requester points to another entity when needed. At least one of requestStatus, statusLabel is not null. Type https://datamodels.jp/ns/fieldservice/ServiceRequest; @context https://datamodels.jp/context/fieldservice/v1.jsonld.",
  "strict": true,
  "schema": {
    "type": "object",
    "properties": {
      "serviceCode": {
        "type": "string",
        "description": "The kind of request, as a code the provider sets (for example bulky-waste); Open311 service_code (not empty)"
      },
      "localGovernmentCode": {
        "type": [
          "string",
          "null"
        ],
        "pattern": "^\\d{6}$",
        "description": "Local government code (全国地方公共団体コード, 6 digits) of the municipality responsible; Open311 jurisdiction_id"
      },
      "provider": {
        "type": [
          "string",
          "null"
        ],
        "description": "The organisation that does the work (a municipality, a contractor) (a URI)"
      },
      "requestedAt": {
        "type": [
          "string",
          "null"
        ],
        "format": "date-time",
        "description": "When the request was made (Open311 requested_datetime)"
      },
      "requestStatus": {
        "type": [
          "string",
          "null"
        ],
        "enum": [
          "received",
          "scheduled",
          "in-progress",
          "completed",
          "cancelled",
          "rejected",
          null
        ],
        "description": "State: received, scheduled (a day is set), in-progress, completed, cancelled, rejected (cannot be done). Open311 open covers received to in-progress, and closed the rest. When no value fits, leave it out and write statusLabel"
      },
      "statusLabel": {
        "type": [
          "string",
          "null"
        ],
        "description": "The source system's own status name, unchanged. Required when the status is left out (not empty)"
      },
      "location": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "Point"
            ]
          },
          "coordinates": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "[longitude, latitude] in WGS 84, optionally with the altitude as a third number"
          }
        },
        "required": [
          "type",
          "coordinates"
        ],
        "additionalProperties": false,
        "description": "Where the work is done (for example where the items are put out); a point only. It can stand in for an address A GeoJSON geometry (Point)."
      },
      "area": {
        "type": [
          "string",
          "null"
        ],
        "description": "The planning area, as the provider names it (not empty)"
      },
      "lines": {
        "type": [
          "array",
          "null"
        ],
        "items": {
          "type": "object",
          "properties": {
            "item": {
              "type": "string",
              "description": "(a URI)"
            },
            "quantity": {
              "type": "integer",
              "description": "(minimum 1)"
            },
            "name": {
              "type": [
                "string",
                "null"
              ],
              "description": "(not empty)"
            }
          },
          "required": [
            "item",
            "quantity",
            "name"
          ],
          "additionalProperties": false
        },
        "minItems": 1,
        "description": "What is asked for: one line per CatalogItem, with its id, the quantity and its name at the time of the request"
      },
      "serviceDuration": {
        "type": [
          "string",
          "null"
        ],
        "description": "Time spent at the place, as an ISO 8601 duration (for example PT5M); the service time of route optimisation (must match the pattern ^P(?!$)(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+(\\.\\d+)?S)?)?$)"
      },
      "load": {
        "type": [
          "array",
          "null"
        ],
        "items": {
          "type": "number",
          "description": "(minimum 0)"
        },
        "minItems": 1,
        "description": "What it takes of a vehicle's capacity, one number per dimension; the provider sets the dimensions and units and keeps them in step with the vehicles' capacity (for example one dimension: volume, counted in points the provider sets); the amount of route optimisation"
      },
      "skills": {
        "type": [
          "array",
          "null"
        ],
        "items": {
          "type": "string",
          "description": "(not empty)"
        },
        "minItems": 1,
        "description": "What the work needs (for example two-person, carry-out); the skills of route optimisation, matched against a vehicle's or crew's skills. The provider sets the words (no duplicates)"
      },
      "priority": {
        "type": [
          "integer",
          "null"
        ],
        "description": "Priority 0 to 9: 1 highest, 9 lowest, 0 undefined (RFC 8984, as in Task) (minimum 0; maximum 9)"
      },
      "timeWindows": {
        "type": [
          "array",
          "null"
        ],
        "items": {
          "type": "object",
          "properties": {
            "start": {
              "type": "string",
              "format": "date-time"
            },
            "end": {
              "type": "string",
              "format": "date-time"
            }
          },
          "required": [
            "start",
            "end"
          ],
          "additionalProperties": false
        },
        "minItems": 1,
        "description": "When the work may be done, as a list of start and end date-times; the time windows of route optimisation: nothing is planned outside them"
      },
      "preferredDate": {
        "type": [
          "string",
          "null"
        ],
        "format": "date",
        "description": "The day the requester would like"
      },
      "flexibility": {
        "type": [
          "string",
          "null"
        ],
        "enum": [
          "fixed",
          "preferred",
          "any",
          null
        ],
        "description": "How much the requester needs that day: fixed (it must be that day), preferred (they would like it), any (any day)"
      },
      "scheduledDate": {
        "type": [
          "string",
          "null"
        ],
        "format": "date",
        "description": "The day the work is planned for"
      },
      "scheduledWindow": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "end": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "start",
          "end"
        ],
        "additionalProperties": false,
        "description": "The planned time window, when one is set"
      },
      "routePlan": {
        "type": [
          "string",
          "null"
        ],
        "description": "The plan of the day this request is in: a RoutePlan (a URI)"
      },
      "task": {
        "type": [
          "string",
          "null"
        ],
        "description": "The work item made from this request: a Task (task subject). Task's refersTo is the other way round: what a task is about (a URI)"
      },
      "fee": {
        "type": [
          "number",
          "null"
        ],
        "description": "Fee, in priceCurrency (minimum 0)"
      },
      "priceCurrency": {
        "type": [
          "string",
          "null"
        ],
        "pattern": "^[A-Z]{3}$",
        "description": "Currency (ISO 4217, for example JPY)"
      },
      "requester": {
        "type": [
          "string",
          "null"
        ],
        "description": "Who asked: a link to their entity. Names and contacts are not kept here but in that entity, so access to them can be limited separately (a URI)"
      },
      "requesterNote": {
        "type": [
          "string",
          "null"
        ],
        "description": "A description in the requester's words; it may contain personal data (not empty)"
      },
      "source": {
        "type": [
          "string",
          "null"
        ],
        "description": "Where the data comes from (a URL, for example) (not empty)"
      }
    },
    "required": [
      "serviceCode",
      "localGovernmentCode",
      "provider",
      "requestedAt",
      "requestStatus",
      "statusLabel",
      "location",
      "area",
      "lines",
      "serviceDuration",
      "load",
      "skills",
      "priority",
      "timeWindows",
      "preferredDate",
      "flexibility",
      "scheduledDate",
      "scheduledWindow",
      "routePlan",
      "task",
      "fee",
      "priceCurrency",
      "requester",
      "requesterNote",
      "source"
    ],
    "additionalProperties": false
  }
}
