{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "RewardFeatureInteraction",
  "type": "object",
  "additionalProperties": false,
  "description": "Log when the rewards notification is shown to the user or when the user interacts with it",
  "properties": {
    "log_context": {
      "$ref": "/resources/schema/analytics/client/v4/LogContext.json",
      "description": "Required Log Context Reference"
    },
    "event_name": {
      "type": "string",
      "enum": [
        "REWARD_FEATURE_INTERACTION"
      ]
    },
    "schema_definition": {
      "type": "string",
      "enum": [
        "RewardFeatureInteraction"
      ]
    },
    "action": {
      "type": "string",
      "description": "The type of engagement with the user",
      "enum": ["IMPRESSION", "CLICK", "DISMISS"]
    },
    "message_type": {
      "type": "string",
      "$ref": "/resources/schema/analytics/client/v4/type/ChallengeMessageType.json",
      "description": "The type of message displayed to the user at different stages of the challenge"
    },
    "score": {
      "type": "number",
      "description": "Overall driver score expressed as a number from 0-100"
    },
    "score_rating": {
      "type": "string",
      "description": "Overall driver score expressed as a verbal rating. E.g. Poor, Good, Very Good, Exceptional etc."
    },
    "challenge_kpi_type": {
      "type": "array",
      "items": {
        "$ref": "/resources/schema/analytics/client/v4/type/ChallengeKpiType.json"
      },
      "description": "Key performance indicator for the challenge. Could be one or combination of following indicators. If combination, add as separate list items."
    },
    "challenge_unit": {
      "type": "string",
      "enum": ["TRIP", "MILE", "DAY", "OTHER"],
      "description": "The unit used to calculate progress of the challenge"
    },
    "goal": {
      "type": "number",
      "description": "Captures the goal of the challenge. For trip-based: number of qualified trips required to complete challenge; For event-to-mile-ratio challenge: target ratio and overall score based challenge: target score to be achieved."
    },
    "progress_miles": {
      "type": "number",
      "description": "Number of miles driven since challenge has started"
    },
    "progress_total_trips": {
      "type": "integer",
      "description": "Number of total trips since challenge has started. Includes qualified and non-qualified trips. Resets when new challenge starts."
    },
    "days_remaining": {
      "type": "integer",
      "description": "Number of days left in the challenge"
    },
    "progress_days": {
      "type": "integer",
      "description": "Number of days since challenge has started"
    },
    "progress": {
      "type": "number",
      "description": "Capture progress towards the goal. This is based on goal type defined above"
    },
    "reward_unit": {
      "type": "string",
      "enum": ["POINTS", "DOLLARS", "BADGES", "OTHER"],
      "description": "The type of reward the user is expecting after completing this challenge"
    },
    "challenge_id": {
      "type": "string",
      "description": "The id of the current or most recent completed challenge"
    },
    "trigger": {
      "type": "string",
      "$ref": "/resources/schema/analytics/client/v4/type/ChallengeTriggerType.json",
      "description": "The moment when challenge message is shown"
    }
  },
  "required": [
    "log_context",
    "event_name",
    "schema_definition",
    "action",
    "message_type",
    "reward_unit",
    "challenge_id",
    "trigger"   
  ]
}