{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "TripScore",
    "type": "object",
    "additionalProperties": false,
    "description": "Trip Score Schema",
    "properties": {
        "log_context": {
            "$ref": "/resources/schema/analytics/client/v4/LogContext.json",
            "description": "Required Log Context Reference"
        },
        "event_name": {
            "type": "string",
            "enum": [
                "TRIP_SCORE"
            ]
        },
        "schema_definition": {
            "type": "string",
            "enum": [
                "TripScore"
            ]
        },
        "trip_id": {
            "type": "string",
            "description": "trip id"
        },
        "start_time": {
            "type": "integer",
            "description": "UTC timestamp in milliseconds for trip start time"
        },
        "end_time": {
            "type": "integer",
            "description": "UTC timestamp in milliseconds for trip end time"
        },
        "origin_lat": {
            "type": "number",
            "description": "Latitude of the trip origin"
        },
        "origin_lon": {
            "type": "number",
            "description": "Longitude of the trip origin"
        },
        "dest_lat": {
            "type": "number",
            "description": "Latitude of the trip destination"
        },
        "dest_lon": {
            "type": "number",
            "description": "Longitude of the trip destination"
        },
        "trip_score": {
            "type": "number",
            "description": "The overall trip coaching score"
        },
        "trip_score_details": {
            "type": "array",
            "items": {
                "$ref": "/resources/schema/analytics/client/v4/type/DrivingScoreItem.json"
            },
            "description": "The list of sub driving score used for coaching score"
        },
        "trip_details": {
            "type": "string",
            "description": "trip details in json for generating the score"
        },
        "score_version": {
            "type": "string",
            "description": "The version of algorithm used for coaching score"

        },
        "trip_safety_score": {
            "type": "number",
            "description": "The overall trip safety score"
        },
        "trip_safety_rating": {
            "type": "integer",
            "description": "The overall trip safety rating in [1, 5]"
        },
        "safety_score_version": {
            "type": "string",
            "description": "The version of algorithm used for safety score"
        }

    },
    "required": [
        "log_context",
        "event_name",
        "schema_definition",
        "start_time",
        "end_time",
        "origin_lat",
        "origin_lon",
        "dest_lat",
        "dest_lon",
        "trip_score"
    ]
}