using UnityEngine;

namespace RudderSdk.Unity
{
  [CreateAssetMenu(menuName = "Rudder/Configuration", fileName = "RudderConfiguration")]
  public class RudderConfiguration : ScriptableObject
  {
    [Tooltip("Project key issued in the Rudder admin panel. Required.")]
    public string ProjectKey;

    [Tooltip("API base URL, e.g. https://api.rudder.build.")]
    public string BaseUrl = "http://localhost:8082";

    [Tooltip("Realtime websocket URL.")]
    public string RealtimeUrl = "ws://localhost:8090/api/realtime/ws";

    [Tooltip("HTTP request timeout in seconds.")]
    [Min(1)]
    public int TimeoutSeconds = 10;

    private void OnValidate()
    {
      if (string.IsNullOrEmpty(ProjectKey))
      {
        Debug.LogWarning(
          "[Rudder] ProjectKey is empty on " + name + ". The SDK cannot authenticate without it.",
          this);
      }
    }
  }
}
