using Castle.Core.Logging;

namespace Pilz.Net.Api;

public interface IApiServer
{
    public delegate void OnCheckAuthenticationEventHandler(object sender, ApiAuthCheckEventArgs e);
    public delegate void OnCheckContextEventHandler(object sender, ApiContextEventArgs e);

    event OnCheckAuthenticationEventHandler? OnCheckAuthentication;
    event OnCheckContextEventHandler OnCheckContext;
    event OnCheckContextEventHandler OnCheckContextCompleted;

    string ApiUrl { get; }

    bool EnableAuth { get; set; }

    IApiMessageSerializer Serializer { get; }

    ILogger Log { get; set; }

    void Start();

    void Stop();

    void RegisterHandler<T>(T instance) where T : class;

    void RegisterHandler(Delegate handler);

    void RegisterHandler(Delegate handler, bool throwOnError);
}
