using MudBlazor;
using salesbook.Shared.Components.SingleElements.Modal;
using salesbook.Shared.Core.Dto;

namespace salesbook.Shared.Core.Helpers;

public class ModalHelpers
{
    public static async Task<DialogResult?> OpenActivityForm(IDialogService dialog, ActivityDTO? activity, string? id)
    {
        var modal = await dialog.ShowAsync<ActivityForm>(
            "Activity form",
            new DialogParameters<ActivityForm>
            {
                { x => x.Id, id },
                { x => x.ActivityCopied, activity }
            },
            new DialogOptions
            {
                FullScreen = true,
                CloseButton = false,
                NoHeader = true
            }
        );

        return await modal.Result;
    }
}