using salesbook.Shared.Core.Interface;
using Shiny;
using Shiny.Push;

namespace salesbook.Maui.Core.System.Notification;

public class FirebaseNotificationService(IPushManager pushManager, IIntegryNotificationRestClient integryNotificationRestClient) : IFirebaseNotificationService
{
    public async Task InitFirebase()
    {
        var (accessState, token) = await pushManager.RequestAccess();
        
        if (accessState == AccessState.Denied || token is null) return;
        await integryNotificationRestClient.Register(token);
    }
}