@namespace OpenArchival.Blazor.AdminPages.Shared
@using Microsoft.AspNetCore.Components.Web
@using MudBlazor

<MudDialog>
    <TitleContent>
        <MudText Typo="Typo.h6">Edit a Category</MudText>
    </TitleContent>

    <DialogContent>
        <AddArchiveGroupingComponent 
            Model="Model"
            FormButtonsEnabled=false></AddArchiveGroupingComponent>
    </DialogContent>

    <DialogActions>
        <MudButton OnClick="OnCancel">Cancel</MudButton>
        <MudButton Color="Color.Primary" OnClick="OnSubmit">OK</MudButton>
    </DialogActions>
</MudDialog>

@code {
    [Parameter]
    public required ArtifactGroupingValidationModel Model { get; set; }

    [CascadingParameter]
    IMudDialogInstance MudDialog { get; set; }

    [Parameter]
    public bool IsUpdate { get; set; } = false;


    private void OnCancel(MouseEventArgs args)
    {
        MudDialog.Cancel();
    }
    private void OnSubmit(MouseEventArgs args)
    {
        MudDialog.Close(DialogResult.Ok(Model));
    }
}
