{
  "$schema": "https://datapackage.org/profiles/2.0/tableschema.json",
  "title": "訪問の依頼",
  "description": "ある場所での作業の依頼です。粗大ごみや災害ごみの収集、配達、修理、点検などにあたります。何を（品目と数）、どこで、いつ（時間の幅と、その日がどれだけ必要か）を表し、作業時間、量、必要な技能も持つので、ルート最適化（VRP）のソフトウェアの job にそのまま渡せます。依頼した人の名前や連絡先は持たず、必要なら requester で別のエンティティを指します。requestStatus、statusLabel のどれか 1 つは必須です。",
  "x-type": "ServiceRequest",
  "x-typeIri": "https://datamodels.jp/ns/fieldservice/ServiceRequest",
  "x-version": "1.0.0",
  "x-schema": "https://datamodels.jp/schema/fieldservice/ServiceRequest/v1.0.0.json",
  "x-context": "https://datamodels.jp/context/fieldservice/v1.jsonld",
  "x-translations": {
    "en": {
      "title": "Service request",
      "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 needed."
    }
  },
  "fields": [
    {
      "name": "id",
      "title": "エンティティの ID",
      "description": "エンティティの ID（URI。例：urn:ngsi-ld:ServiceRequest:001）",
      "type": "string",
      "constraints": {
        "required": true,
        "unique": true
      },
      "x-translations": {
        "en": {
          "title": "Entity id",
          "description": "Entity id: a URI, for example urn:ngsi-ld:ServiceRequest:001"
        }
      }
    },
    {
      "name": "serviceCode",
      "title": "依頼の種類を表すコード",
      "description": "依頼の種類を表すコード（例：bulky-waste）。提供者が決めます。Open311 の service_code にあたります。",
      "type": "string",
      "x-iri": "https://datamodels.jp/ns/fieldservice/serviceCode",
      "constraints": {
        "required": true,
        "minLength": 1
      },
      "x-translations": {
        "en": {
          "description": "The kind of request, as a code the provider sets (for example bulky-waste); Open311 service_code"
        }
      }
    },
    {
      "name": "localGovernmentCode",
      "title": "依頼を受け持つ自治体の全国地方公共団体コード",
      "description": "依頼を受け持つ自治体の全国地方公共団体コード（6 桁）。Open311 の jurisdiction_id にあたります。",
      "type": "string",
      "x-iri": "https://datamodels.jp/ns/common/localGovernmentCode",
      "constraints": {
        "pattern": "\\d{6}"
      },
      "x-translations": {
        "en": {
          "title": "Local government code",
          "description": "Local government code (全国地方公共団体コード, 6 digits) of the municipality responsible; Open311 jurisdiction_id"
        }
      }
    },
    {
      "name": "provider",
      "title": "作業を引き受ける組織",
      "description": "作業を引き受ける組織（自治体、委託先など）",
      "type": "string",
      "format": "uri",
      "x-iri": "https://schema.org/provider",
      "x-translations": {
        "en": {
          "title": "The organisation that does the work",
          "description": "The organisation that does the work (a municipality, a contractor)"
        }
      }
    },
    {
      "name": "requestedAt",
      "title": "依頼を受けた日時",
      "description": "依頼を受けた日時（Open311 の requested_datetime）",
      "type": "datetime",
      "x-iri": "https://datamodels.jp/ns/fieldservice/requestedAt",
      "x-translations": {
        "en": {
          "title": "When the request was made",
          "description": "When the request was made (Open311 requested_datetime)"
        }
      }
    },
    {
      "name": "requestStatus",
      "title": "状態",
      "description": "状態：received（受付）、scheduled（日が決まった）、in-progress（作業中）、completed（完了）、cancelled（取消）、rejected（受けられない）。Open311 の open は received から in-progress、closed は残りにあたります。合う値がなければ省き、statusLabel を書きます。",
      "type": "string",
      "x-iri": "https://datamodels.jp/ns/fieldservice/requestStatus",
      "constraints": {
        "enum": [
          "received",
          "scheduled",
          "in-progress",
          "completed",
          "cancelled",
          "rejected"
        ]
      },
      "x-translations": {
        "en": {
          "title": "State",
          "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"
        }
      }
    },
    {
      "name": "statusLabel",
      "title": "元のシステムの状態名をそのまま",
      "description": "元のシステムの状態名をそのまま。状態の値が合わないときは必須です。",
      "type": "string",
      "x-iri": "https://datamodels.jp/ns/task/statusLabel",
      "constraints": {
        "minLength": 1
      },
      "x-translations": {
        "en": {
          "description": "The source system's own status name, unchanged. Required when the status is left out"
        }
      }
    },
    {
      "name": "longitude",
      "title": "location の経度",
      "description": "location の経度（WGS 84、十進の度）",
      "type": "number",
      "x-iri": "https://uri.etsi.org/ngsi-ld/location",
      "constraints": {
        "required": true,
        "minimum": -180,
        "maximum": 180
      },
      "x-translations": {
        "en": {
          "title": "Longitude of location in WGS 84",
          "description": "Longitude of location in WGS 84 (decimal degrees)"
        }
      }
    },
    {
      "name": "latitude",
      "title": "location の緯度",
      "description": "location の緯度（WGS 84、十進の度）",
      "type": "number",
      "x-iri": "https://uri.etsi.org/ngsi-ld/location",
      "constraints": {
        "required": true,
        "minimum": -90,
        "maximum": 90
      },
      "x-translations": {
        "en": {
          "title": "Latitude of location in WGS 84",
          "description": "Latitude of location in WGS 84 (decimal degrees)"
        }
      }
    },
    {
      "name": "area",
      "title": "計画の単位となる地区",
      "description": "計画の単位となる地区。提供者が決めた名前です。",
      "type": "string",
      "x-iri": "https://datamodels.jp/ns/fieldservice/area",
      "constraints": {
        "minLength": 1
      },
      "x-translations": {
        "en": {
          "description": "The planning area, as the provider names it"
        }
      }
    },
    {
      "name": "lines",
      "title": "依頼の中身",
      "description": "依頼の中身。CatalogItem ごとに 1 行で、品目の ID、数、依頼したときの名前です。",
      "type": "array",
      "x-iri": "https://datamodels.jp/ns/fieldservice/lines",
      "constraints": {
        "jsonSchema": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "item",
              "quantity"
            ],
            "properties": {
              "item": {
                "type": "string",
                "format": "uri"
              },
              "quantity": {
                "type": "integer",
                "minimum": 1
              },
              "name": {
                "type": "string",
                "minLength": 1
              }
            }
          },
          "description": "What is asked for: one line per CatalogItem, with its id, the quantity and its name at the time of the request"
        }
      },
      "x-translations": {
        "en": {
          "title": "What is asked for",
          "description": "What is asked for: one line per CatalogItem, with its id, the quantity and its name at the time of the request"
        }
      }
    },
    {
      "name": "serviceDuration",
      "title": "現場での作業時間",
      "description": "現場での作業時間。ISO 8601 の期間（例：PT5M）。ルート最適化の service time にあたります。",
      "type": "string",
      "x-pattern": "^P(?!$)(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+(\\.\\d+)?S)?)?$",
      "x-iri": "https://datamodels.jp/ns/fieldservice/serviceDuration",
      "x-translations": {
        "en": {
          "description": "Time spent at the place, as an ISO 8601 duration (for example PT5M); the service time of route optimisation"
        }
      }
    },
    {
      "name": "load",
      "title": "車両の積載量のうち、この作業で使う量",
      "description": "車両の積載量のうち、この作業で使う量。次元ごとの数で、次元と単位は提供者が決めて、車両の capacity と揃えます（例：容積を提供者が決めた点数で数える 1 次元）。ルート最適化の amount にあたります。複数の値は ; で区切ります。",
      "type": "list",
      "itemType": "number",
      "delimiter": ";",
      "x-iri": "https://datamodels.jp/ns/fieldservice/load",
      "constraints": {
        "minLength": 1
      },
      "x-translations": {
        "en": {
          "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. Several values separated by ;."
        }
      }
    },
    {
      "name": "skills",
      "title": "作業に必要なこと",
      "description": "作業に必要なこと（例：two-person、carry-out）。ルート最適化の skills にあたり、車両や班の skills と照らし合わせます。語は提供者が決めます。複数の値は ; で区切ります。",
      "type": "list",
      "itemType": "string",
      "delimiter": ";",
      "x-iri": "https://datamodels.jp/ns/fieldservice/skills",
      "constraints": {
        "minLength": 1
      },
      "x-translations": {
        "en": {
          "title": "What the work needs",
          "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. Several values separated by ;."
        }
      }
    },
    {
      "name": "priority",
      "title": "優先度 0〜9",
      "description": "優先度 0〜9。1 が最高、9 が最低で、0 は未定義です（RFC 8984、Task と同じ）。",
      "type": "integer",
      "x-iri": "https://datamodels.jp/ns/task/priority",
      "constraints": {
        "minimum": 0,
        "maximum": 9
      },
      "x-translations": {
        "en": {
          "title": "Priority 0 to 9",
          "description": "Priority 0 to 9: 1 highest, 9 lowest, 0 undefined (RFC 8984, as in Task)"
        }
      }
    },
    {
      "name": "timeWindows",
      "title": "作業してよい時間の幅",
      "description": "作業してよい時間の幅（開始と終了の日時）のリスト。ルート最適化の time windows で、この外には計画しません。",
      "type": "array",
      "x-iri": "https://datamodels.jp/ns/fieldservice/timeWindows",
      "constraints": {
        "jsonSchema": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "properties": {
              "start": {
                "type": "string",
                "format": "date-time"
              },
              "end": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "start",
              "end"
            ],
            "additionalProperties": false
          },
          "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"
        }
      },
      "x-translations": {
        "en": {
          "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"
        }
      }
    },
    {
      "name": "preferredDate",
      "title": "依頼した人が望む日",
      "description": "依頼した人が望む日",
      "type": "date",
      "x-iri": "https://datamodels.jp/ns/fieldservice/preferredDate",
      "x-translations": {
        "en": {
          "title": "The day the requester would like",
          "description": "The day the requester would like"
        }
      }
    },
    {
      "name": "flexibility",
      "title": "その日がどれだけ必要か",
      "description": "その日がどれだけ必要か：fixed（その日でないと困る）、preferred（できればその日）、any（いつでもよい）",
      "type": "string",
      "x-iri": "https://datamodels.jp/ns/fieldservice/flexibility",
      "constraints": {
        "enum": [
          "fixed",
          "preferred",
          "any"
        ]
      },
      "x-translations": {
        "en": {
          "title": "How much the requester needs that day",
          "description": "How much the requester needs that day: fixed (it must be that day), preferred (they would like it), any (any day)"
        }
      }
    },
    {
      "name": "scheduledDate",
      "title": "決まった作業日",
      "description": "決まった作業日",
      "type": "date",
      "x-iri": "https://datamodels.jp/ns/fieldservice/scheduledDate",
      "x-translations": {
        "en": {
          "title": "The day the work is planned for",
          "description": "The day the work is planned for"
        }
      }
    },
    {
      "name": "scheduledWindow",
      "title": "決まった時間の幅",
      "description": "決まった時間の幅（決まっているとき）",
      "type": "object",
      "x-iri": "https://datamodels.jp/ns/fieldservice/scheduledWindow",
      "constraints": {
        "jsonSchema": {
          "type": "object",
          "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"
        }
      },
      "x-translations": {
        "en": {
          "title": "The planned time window, when one is set",
          "description": "The planned time window, when one is set"
        }
      }
    },
    {
      "name": "routePlan",
      "title": "この依頼を入れた日ごとのルート",
      "description": "この依頼を入れた日ごとのルート（RoutePlan）",
      "type": "string",
      "format": "uri",
      "x-iri": "https://datamodels.jp/ns/fieldservice/routePlan",
      "x-translations": {
        "en": {
          "title": "The plan of the day this request is in",
          "description": "The plan of the day this request is in: a RoutePlan"
        }
      }
    },
    {
      "name": "task",
      "title": "この依頼から作った作業",
      "description": "この依頼から作った作業（task 分野の Task）。Task の refersTo は反対向きで、作業が何についてかを指します。",
      "type": "string",
      "format": "uri",
      "x-iri": "https://datamodels.jp/ns/fieldservice/task",
      "x-translations": {
        "en": {
          "title": "The work item made from this request",
          "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"
        }
      }
    },
    {
      "name": "fee",
      "title": "手数料",
      "description": "手数料（priceCurrency の通貨で）",
      "type": "number",
      "x-iri": "https://datamodels.jp/ns/fieldservice/fee",
      "constraints": {
        "minimum": 0
      },
      "x-translations": {
        "en": {
          "title": "Fee, in priceCurrency",
          "description": "Fee, in priceCurrency"
        }
      }
    },
    {
      "name": "priceCurrency",
      "title": "通貨",
      "description": "通貨（ISO 4217、例：JPY）",
      "type": "string",
      "x-iri": "https://schema.org/priceCurrency",
      "constraints": {
        "pattern": "[A-Z]{3}"
      },
      "x-translations": {
        "en": {
          "title": "Currency",
          "description": "Currency (ISO 4217, for example JPY)"
        }
      }
    },
    {
      "name": "requester",
      "title": "依頼した人",
      "description": "依頼した人（そのエンティティ）。名前や連絡先はここに入れず、別のエンティティに置いて、見せる相手を分けます。",
      "type": "string",
      "format": "uri",
      "x-iri": "https://datamodels.jp/ns/fieldservice/requester",
      "x-translations": {
        "en": {
          "title": "Who asked",
          "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"
        }
      }
    },
    {
      "name": "requesterNote",
      "title": "依頼した人の言葉での説明",
      "description": "依頼した人の言葉での説明。個人を特定できることが書かれることがあります。",
      "type": "string",
      "x-iri": "https://datamodels.jp/ns/fieldservice/requesterNote",
      "constraints": {
        "minLength": 1
      },
      "x-translations": {
        "en": {
          "title": "A description in the requester's words",
          "description": "A description in the requester's words; it may contain personal data"
        }
      }
    },
    {
      "name": "source",
      "title": "データの出典",
      "description": "データの出典（URL など）",
      "type": "string",
      "x-iri": "https://smart-data-models.github.io/data-models/terms.jsonld#/definitions/source",
      "constraints": {
        "minLength": 1
      },
      "x-translations": {
        "en": {
          "title": "Where the data comes from",
          "description": "Where the data comes from (a URL, for example)"
        }
      }
    }
  ],
  "primaryKey": [
    "id"
  ],
  "missingValues": [
    ""
  ]
}
