using MudBlazor;

namespace FrontOffice.Main.Utilities;

public class AuthDialogService
{
    private readonly IDialogService _dialogService;
    private readonly IDeviceDetector _deviceDetector;
    private readonly DialogOptions _dialogOptions = new()
    {
        MaxWidth = MaxWidth.ExtraSmall,
        FullWidth = true,
        CloseButton = true
    };

    public AuthDialogService(IDialogService dialogService, IDeviceDetector deviceDetector)
    {
        ArgumentNullException.ThrowIfNull(dialogService);
        ArgumentNullException.ThrowIfNull(deviceDetector);
        _dialogService = dialogService!;
        _deviceDetector = deviceDetector!;
    }

    public async Task ShowAuthDialogAsync()
    {
        var dialog = await _dialogService.ShowAsync<Shared.AuthDialog>("ورود به حساب کاربری", _dialogOptions);
        var result = await dialog.Result;

        if (!result.Canceled)
        {
            // User logged in successfully
            // You can add additional logic here if needed
        }
    }
}