{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "HOS Daily Log",
  "type": "object",
  "properties": {
    "connectionId": {
      "type": "string",
      "description": "The ID of the connection that this record belongs to."
    },
    "id": {
      "title": "HOSDailyLogId",
      "type": "string",
      "format": "ulid"
    },
    "sourceId": {
      "title": "SourceId",
      "type": "string",
      "description": "The ID used to represent the entity in the source system."
    },
    "provider": {
      "type": "string",
      "description": "Every provider has a unique code to identify it across Terminal's system. You can find each provider's code under [provider details](/providers)."
    },
    "driver": {
      "description": "The driver this log belongs to.",
      "title": "DriverId",
      "type": "string",
      "format": "ulid",
      "pattern": "^drv_[0-9A-HJKMNP-TV-Z]{26}$"
    },
    "vehicles": {
      "type": "array",
      "description": "Vehicles associated with this daily HOS log.",
      "items": {
        "title": "VehicleId",
        "description": "Unique identifier for the vehicle in Terminal.",
        "type": "string",
        "format": "ulid",
        "pattern": "^vcl_[0-9A-HJKMNP-TV-Z]{26}$"
      }
    },
    "date": {
      "type": "string",
      "format": "date"
    },
    "distances": {
      "type": "object",
      "description": "Breakdown of different distance measurements for the day when available in the source system",
      "properties": {
        "total": {
          "description": "Total distance driven during this day in kilometers",
          "title": "Distance In Kilometers",
          "type": "number",
          "format": "double"
        },
        "driving": {
          "description": "Distance driven during driving",
          "title": "Distance In Kilometers",
          "type": "number",
          "format": "double"
        },
        "personalConveyance": {
          "description": "Distance driven during personal conveyance",
          "title": "Distance In Kilometers",
          "type": "number",
          "format": "double"
        },
        "yardMove": {
          "description": "Distance driven during yard moves",
          "title": "Distance In Kilometers",
          "type": "number",
          "format": "double"
        }
      }
    },
    "statusDurations": {
      "type": "object",
      "properties": {
        "onDuty": {
          "title": "DurationInMS",
          "type": "integer",
          "description": "Duration in MS"
        },
        "offDuty": {
          "title": "DurationInMS",
          "type": "integer",
          "description": "Duration in MS"
        },
        "driving": {
          "title": "DurationInMS",
          "type": "integer",
          "description": "Duration in MS"
        },
        "waiting": {
          "title": "DurationInMS",
          "type": "integer",
          "description": "Duration in MS"
        },
        "sleeperBed": {
          "title": "DurationInMS",
          "type": "integer",
          "description": "Duration in MS"
        },
        "personalConveyance": {
          "title": "DurationInMS",
          "type": "integer",
          "description": "Duration in MS"
        },
        "yardMove": {
          "title": "DurationInMS",
          "type": "integer",
          "description": "Duration in MS"
        }
      }
    },
    "metadata": {
      "title": "EntityMetadata",
      "type": "object",
      "description": "Internal metadata about the record.",
      "required": ["addedAt", "modifiedAt"],
      "properties": {
        "addedAt": {
          "title": "AddedAt",
          "type": "string",
          "format": "date-time",
          "description": "The date and time the record was ingested into Terminal. Note: this is not the date and time the record was created in the provider's system."
        },
        "modifiedAt": {
          "title": "ModifiedAt",
          "type": "string",
          "format": "date-time",
          "description": "The date and time the record was last updated in Terminal. Note: this is not the date and time the record was updated in the provider's system."
        }
      }
    },
    "raw": {
      "title": "RawDataList",
      "type": "array",
      "items": {
        "title": "RawData",
        "type": "object",
        "properties": {
          "provider": {
            "type": "string"
          },
          "schema": {
            "type": "string"
          },
          "extractedAt": {
            "type": "string"
          },
          "data": {
            "type": "object"
          }
        },
        "required": ["provider", "schema", "extractedAt", "data"]
      }
    }
  },
  "required": [
    "connectionId",
    "id",
    "sourceId",
    "provider",
    "driver",
    "date",
    "statusDurations",
    "metadata"
  ]
}
