using UnityEngine;

namespace IndieCrab
{
    [CreateAssetMenu(fileName = "IndieCrabConfiguration", menuName = "ScriptableObjects/IndieCrabConfiguration", order = 1)]
    public class IndieCrabConfiguration : ScriptableObject
    {
        [Header("Connection")]
        [Tooltip("API key used to authenticate log uploads to IndieCrab.")]
        [SerializeField] private string apiKey;

        [Header("Editor")]
        [Tooltip("If enabled, logs created while running in the Unity Editor can be sent to IndieCrab.")]
        [SerializeField] private bool allowLoggingFromEditor = false;

        [Header("Reported Log Types")]
        [Tooltip("If enabled, exceptions are sent to IndieCrab.")]
        [SerializeField] private bool reportException = true;
        [Tooltip("If enabled, error logs are sent to IndieCrab.")]
        [SerializeField] private bool reportError = true;
        [Tooltip("If enabled, warning logs are sent to IndieCrab.")]
        [SerializeField] private bool reportWarning = false;

        public string ApiKey => apiKey;
        public int MaxQueuedMessages => 128;
        public bool AllowLoggingFromEditor => allowLoggingFromEditor;

        public bool IsValidLogType(LogType type)
        {
            if (type == LogType.Error && reportError) return true;
            if (type == LogType.Exception && reportException) return true;
            if (type == LogType.Warning && reportWarning) return true;

            return false;
        }
       
    }
}
