using CommunityToolkit.Mvvm.Messaging;

namespace SteUp.Shared.Core.Messages.Scanner;

public class OnScannerService
{
    public event Action<string?>? OnNewScanSuccessful;
    public event Action<string?>? OnErrorScan;

    public OnScannerService(IMessenger messenger)
    {
        messenger.Register<NewScannerMessage>(this, (_, x) => { OnNewScanSuccessful?.Invoke(x.Value); });
        messenger.Register<ErrorScannerMessage>(this, (_, x) => { OnErrorScan?.Invoke(x.Value); });
    }
}