{
  "namespace": "tabAnalytics",
  "types": [
    {
      "id": "tabAnalytics.EventType",
      "type": "string",
      "enum": [
        {
          "name": "action"
        },
        {
          "name": "click"
        },
        {
          "name": "custom"
        },
        {
          "name": "show"
        },
        {
          "name": "task"
        }
      ]
    },
    {
      "id": "tabAnalytics.UserConfig",
      "type": "object",
      "properties": {
        "user_id": {
          "type": "string"
        },
        "display_name": {
          "type": "string",
          "optional": true
        },
        "phone": {
          "type": "string",
          "optional": true
        },
        "user_properties": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "optional": true
        }
      }
    },
    {
      "id": "tabAnalytics.AnalyticsEvent",
      "type": "object",
      "properties": {
        "type": {
          "$ref": "tabAnalytics.EventType"
        },
        "module_name": {
          "type": "string"
        },
        "sub_module_name": {
          "type": "string",
          "optional": true
        },
        "name": {
          "type": "string"
        },
        "content": {
          "type": "string",
          "optional": true
        },
        "timestamp": {
          "type": "number",
          "optional": true
        },
        "user_info": {
          "$ref": "tabAnalytics.UserConfig",
          "optional": true
        },
        "session_id": {
          "type": "string",
          "optional": true
        },
        "visitor_id": {
          "type": "string",
          "optional": true
        },
        "extra_info": {
          "type": "string",
          "optional": true
        },
        "screen_resolution": {
          "type": "string",
          "optional": true
        },
        "language": {
          "type": "string",
          "optional": true
        },
        "user_agent": {
          "type": "string",
          "optional": true
        },
        "operating_system": {
          "type": "string",
          "optional": true
        }
      }
    },
    {
      "id": "tabAnalytics.ResponseBase",
      "type": "object",
      "properties": {
        "error_code": {
          "type": "integer"
        },
        "error_message": {
          "type": "string"
        }
      }
    }
  ],
  "functions": [
    {
      "name": "recordEvent",
      "type": "function",
      "parameters": [
        {
          "name": "event",
          "$ref": "tabAnalytics.AnalyticsEvent"
        }
      ],
      "returns_async": {
        "name": "callback",
        "parameters": [
          {
            "name": "response",
            "$ref": "tabAnalytics.ResponseBase"
          }
        ]
      }
    }
  ],
  "events": [
    {
      "name": "onEventRecorded",
      "type": "function",
      "parameters": [
        {
          "name": "event",
          "$ref": "tabAnalytics.AnalyticsEvent"
        }
      ]
    },
    {
      "name": "onEventFailed",
      "type": "function",
      "parameters": [
        {
          "name": "event",
          "$ref": "tabAnalytics.AnalyticsEvent"
        },
        {
          "name": "error",
          "type": "string"
        }
      ]
    }
  ]
}