<AdminDataPanel Loading="@false">
    <AdminFormSection Title="그룹 선택" Description="코드 그룹을 먼저 선택합니다." CssClass="mb-4">
        <MudSelect T="string"
                   Value="@SelectedGroup"
                   ValueChanged="OnSelectedGroupChanged"
                   Label="코드 그룹"
                   Variant="Variant.Outlined"
                   FullWidth="true"
                   Clearable="true">
            <MudSelectItem Value="@string.Empty">선택</MudSelectItem>
            @foreach (var group in Groups)
            {
                <MudSelectItem Value="@group">@group</MudSelectItem>
            }
        </MudSelect>
    </AdminFormSection>

    <AdminFormSection Title="새 코드" Description="선택한 그룹에 항목을 추가합니다.">
        <MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="OnCreateRequested">새 코드 추가</MudButton>
    </AdminFormSection>
</AdminDataPanel>

@code {
    [Parameter, EditorRequired]
    public IReadOnlyList<string> Groups { get; set; } = [];

    [Parameter]
    public string SelectedGroup { get; set; } = "";

    [Parameter, EditorRequired]
    public EventCallback<string> SelectedGroupChanged { get; set; }

    [Parameter, EditorRequired]
    public EventCallback OnCreateRequested { get; set; }

    private Task OnSelectedGroupChanged(string value) => SelectedGroupChanged.InvokeAsync(value);
}
