// Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
using System;
using System.Collections.Generic;

namespace Alibabacloud.Rum.Unity.Rum
{
    /// <summary>
    /// Describe the source of a RUM Error.
    /// </summary>
    public enum RumErrorSource
    {
        /// <summary>Error originated in the source code.</summary>
        Source,

        /// <summary>Error originated in the network layer.</summary>
        Network,

        /// <summary>Error originated in a webview.</summary>
        WebView,

        /// <summary>Error originated in a web console (used by bridges).</summary>
        Console,

        /// <summary>Custom error source.</summary>
        Custom,
    }

    /// <summary>
    /// The HTTP method used to request a resource.
    /// </summary>
    public enum RumHttpMethod
    {
        Post,
        Get,
        Head,
        Put,
        Delete,
        Patch,
    }

    /// <summary>
    /// Describe the type of resource loaded.
    /// </summary>
    public enum RumResourceType
    {
        Document,
        Image,
        Xhr,
        Beacon,
        Css,
        Fetch,
        Font,
        Js,
        Media,
        Other,
        Native,
    }

    /// <summary>
    /// Describes the type of a RUM Action.
    /// </summary>
    public enum RumUserActionType
    {
        /// <summary>The user tapped (or clicked) the screen.</summary>
        Tap,

        /// <summary>The user scrolled the screen.</summary>
        Scroll,

        /// <summary>The user performed a swipe or drag action.</summary>
        Swipe,

        /// <summary>A custom user action.</summary>
        Custom,
    }

    public interface IAlibabacloudRum
    {

        public void ReportException(Exception ex);

        public void ReportResource(string type,
            string url,
            string method,
            int statusCode,
            string errorMessage,
            bool success,
            TraceContext traceContext,
            Measuring measuring);

        public void ReportEvent(string eventName, string group, double value,
            Dictionary<string, object> info);
            
        public void ReportLog(string logContent, string logName, string logLevel, string stackTrace, Dictionary<string, object> extraInfo);

        public void StartView(string key, string name, Dictionary<string, object> attributes);

        public void StopView(string key, Dictionary<string, object> attributes);
    }

    #region NoOp Implementation

    internal class AlibabacloudNoOpRum : IAlibabacloudRum
    {
        public void ReportException(Exception ex)
        {
            
        }

        public void ReportResource(string type,
            string url,
            string method,
            int statusCode,
            string errorMessage,
            bool success,
            TraceContext traceContext,
            Measuring measuring)
        {
            
        }

        public void ReportEvent(string eventName, string group, double value,
            Dictionary<string, object> info)
        {
            
        }

        public void ReportLog(string logContent, string logName, string logLevel, string stackTrace, Dictionary<string, object> extraInfo)
        {
            
        }

        public void StartView(string key, string name, Dictionary<string, object> attributes)
        {
            
        }

        public void StopView(string key, Dictionary<string, object> attributes)
        {
            
        }
    }

    #endregion
}
