@using BackOffice.Services.Tag

<MudDialog>
    <DialogContent>
        <EditForm Model="@Model" OnValidSubmit="HandleValidSubmit">
            <MudStack Spacing="2">
                <MudTextField @bind-Value="Model.Name"
                              Label="نام (انگلیسی)"
                              Required="true"
                              Variant="Variant.Outlined" />

                <MudTextField @bind-Value="Model.Title"
                              Label="عنوان (نمایش در UI)"
                              Required="true"
                              Variant="Variant.Outlined" />

                <MudTextField @bind-Value="Model.Description"
                              Label="توضیحات"
                              Variant="Variant.Outlined"
                              Lines="3"
                              Text="@Model.Description" />

                <MudStack Row="true" AlignItems="AlignItems.Center" Spacing="1">
                    <MudSwitch T="bool" @bind-Value="Model.IsActive" Color="Color.Primary" />
                    <MudText Typo="Typo.body2">فعال</MudText>
                </MudStack>

                <MudNumericField T="int"
                                 @bind-Value="Model.SortOrder"
                                 Label="ترتیب نمایش"
                                 Variant="Variant.Outlined" />
            </MudStack>
        </EditForm>
    </DialogContent>
    <DialogActions>
        <MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="SubmitAsync">
            @(_isEditMode ? "ذخیره تغییرات" : "ایجاد تگ")
        </MudButton>
        <MudButton Color="Color.Default" Variant="Variant.Text" OnClick="Cancel">
            انصراف
        </MudButton>
    </DialogActions>
</MudDialog>

