{
  "type": "RoutePlan",
  "domain": "fieldservice",
  "description": "ある日、ある地区の作業の計画です。車両ごとのルート（回る依頼の順番と、着く時刻と出る時刻）と、入らなかった依頼を持ちます。ルート最適化（VRP）のソフトウェアの結果（routes と unassigned）をそのまま残せます。計画を実際に走った記録は、Smart Data Models の FleetVehicleOperation で表せます。",
  "contextUrl": "https://datamodels.jp/context/fieldservice/v1.jsonld",
  "propertyDetails": {
    "provider": {
      "ngsiType": "Relationship",
      "valueType": "uri",
      "example": "urn:ngsi-ld:Organization:131016",
      "required": false,
      "description": "作業を引き受ける組織（自治体、委託先など）",
      "@context": "https://schema.org/provider"
    },
    "localGovernmentCode": {
      "ngsiType": "Property",
      "valueType": "string",
      "example": "131016",
      "required": false,
      "description": "計画する自治体の全国地方公共団体コード（6 桁）",
      "@context": "https://datamodels.jp/ns/common/localGovernmentCode",
      "validation": {
        "pattern": "^\\d{6}$"
      }
    },
    "area": {
      "ngsiType": "Property",
      "valueType": "string",
      "example": "kanda",
      "required": false,
      "description": "計画の単位となる地区。提供者が決めた名前です。",
      "@context": "https://datamodels.jp/ns/fieldservice/area",
      "validation": {
        "minLength": 1
      }
    },
    "planDate": {
      "ngsiType": "Property",
      "valueType": "date",
      "example": "2026-07-16",
      "required": true,
      "description": "計画した日（作業する日）",
      "@context": "https://datamodels.jp/ns/fieldservice/planDate"
    },
    "planStatus": {
      "ngsiType": "Property",
      "valueType": "string",
      "example": "confirmed",
      "required": false,
      "description": "状態：draft（案）、confirmed（確定）、in-progress（実行中）、completed（完了）、cancelled（取消）。合う値がなければ省き、statusLabel を書きます。",
      "@context": "https://datamodels.jp/ns/fieldservice/planStatus",
      "validation": {
        "enum": [
          "draft",
          "confirmed",
          "in-progress",
          "completed",
          "cancelled"
        ]
      }
    },
    "statusLabel": {
      "ngsiType": "Property",
      "valueType": "string",
      "example": null,
      "required": false,
      "description": "元のシステムの状態名をそのまま。状態の値が合わないときは必須です。",
      "@context": "https://datamodels.jp/ns/task/statusLabel",
      "validation": {
        "minLength": 1
      }
    },
    "planner": {
      "ngsiType": "Property",
      "valueType": "string",
      "example": "VROOM 1.14",
      "required": false,
      "description": "計画に使ったソフトウェアとその版（例：VROOM 1.14）",
      "@context": "https://datamodels.jp/ns/fieldservice/planner",
      "validation": {
        "minLength": 1
      }
    },
    "computedAt": {
      "ngsiType": "Property",
      "valueType": "datetime",
      "example": "2026-07-15T17:05:00+09:00",
      "required": false,
      "description": "計画を計算した日時",
      "@context": "https://datamodels.jp/ns/fieldservice/computedAt"
    },
    "vehicles": {
      "ngsiType": "Relationship",
      "valueType": "uri",
      "example": [
        "urn:ngsi-ld:ServiceVehicle:131016:truck-02"
      ],
      "required": false,
      "description": "計画に使った車両（ServiceVehicle）。key-values の形では、1 台でも配列です。",
      "@context": "https://datamodels.jp/ns/fieldservice/vehicles",
      "objectType": "https://datamodels.jp/ns/fieldservice/ServiceVehicle"
    },
    "serviceRequests": {
      "ngsiType": "Relationship",
      "valueType": "uri",
      "example": [
        "urn:ngsi-ld:ServiceRequest:131016-2026-0716-0042"
      ],
      "required": false,
      "description": "計画した依頼（ServiceRequest）。入らなかったものも含みます。key-values の形では、1 件でも配列です。",
      "@context": "https://datamodels.jp/ns/fieldservice/serviceRequests",
      "objectType": "https://datamodels.jp/ns/fieldservice/ServiceRequest"
    },
    "routes": {
      "ngsiType": "Property",
      "valueType": "array",
      "example": [
        {
          "vehicle": "urn:ngsi-ld:ServiceVehicle:131016:truck-02",
          "crew": "urn:ngsi-ld:Crew:131016:field-team-a",
          "start": "2026-07-16T08:00:00+09:00",
          "end": "2026-07-16T08:46:00+09:00",
          "distance": 5400,
          "duration": "PT46M",
          "load": [
            3
          ],
          "stops": [
            {
              "kind": "start",
              "position": [
                139.75354,
                35.693947
              ],
              "departure": "2026-07-16T08:00:00+09:00"
            },
            {
              "kind": "job",
              "request": "urn:ngsi-ld:ServiceRequest:131016-2026-0716-0042",
              "position": [
                139.7703,
                35.6956
              ],
              "arrival": "2026-07-16T08:15:00+09:00",
              "departure": "2026-07-16T08:23:00+09:00",
              "load": [
                3
              ]
            },
            {
              "kind": "end",
              "position": [
                139.75354,
                35.693947
              ],
              "arrival": "2026-07-16T08:46:00+09:00"
            }
          ]
        }
      ],
      "required": true,
      "description": "車両ごとのルート。車両、班、出発と帰着の時刻、距離（メートル）、時間、積んだ量と、止まる所（start、job、break、end）の順番です。job には依頼（request）、位置、着く時刻と出る時刻を書きます。位置は依頼の location と同じです。",
      "@context": "https://datamodels.jp/ns/fieldservice/routes"
    },
    "unassigned": {
      "ngsiType": "Property",
      "valueType": "array",
      "example": [],
      "required": false,
      "description": "入らなかった依頼（ServiceRequest の ID）。全部入ったときは空の配列です。",
      "@context": "https://datamodels.jp/ns/fieldservice/unassigned",
      "validation": {
        "uniqueItems": true
      }
    },
    "totalDistance": {
      "ngsiType": "Property",
      "valueType": "number",
      "example": 5400,
      "required": false,
      "description": "すべてのルートの距離の合計（メートル）",
      "@context": "https://datamodels.jp/ns/fieldservice/totalDistance",
      "validation": {
        "minimum": 0
      }
    },
    "totalDuration": {
      "ngsiType": "Property",
      "valueType": "string",
      "example": "PT46M",
      "required": false,
      "description": "すべてのルートの時間の合計（ISO 8601 の期間）",
      "@context": "https://datamodels.jp/ns/fieldservice/totalDuration"
    },
    "source": {
      "ngsiType": "Property",
      "valueType": "string",
      "example": null,
      "required": false,
      "description": "データの出典（URL など）",
      "@context": "https://smart-data-models.github.io/data-models/terms.jsonld#/definitions/source",
      "validation": {
        "minLength": 1
      }
    }
  },
  "additionalProperties": false
}
