@using TIAMWebApp.Shared.Application.Models.PageModels;
@using TIAMWebApp.Shared.Application.Utility;
<EditForm Model="@regModel" OnValidSubmit="GoToNextStep">
            <DataAnnotationsValidator />
    

    <div class="form-field d-flex align-items-center">
        

        <DxMaskedInput @bind-Value="@regModel.Email"
        Id="Email"
               CssClass="cw-320"                          
               Mask="@EmailMask"
               MaskMode="MaskMode.RegEx">
    <DxRegExMaskProperties MaskAutoCompleteMode="@((MaskAutoCompleteMode)AutoCompleteMode)"
                           Placeholder="Placeholder"
                           PlaceholdersVisible="PlaceholderVisible" />
                           </DxMaskedInput>
        
        
    </div>
    <ValidationMessage For="@(() => regModel.Email)" />
    
    <button class="btn btn-primary mt-3" type="submit">
        <span class="@spinnerClass"></span>
        Next
        </button>
    
</EditForm>



@code {
    [Parameter]
    public RegistrationModel regModel { get; set; }

    //[Parameter]
    //public string Email { get; set; }

    [Parameter]
    public EventCallback<string> onNext { get; set; }

    [Parameter]
    public EventCallback<RegistrationModel> RegModelChanged { get; set; }    

    //string EmailMask { get; set; } = @"(\w|[.-])+@(\w|-)+\.(\w|-){2,4}";
    string EmailMask { get; set; } = TIAMRegularExpressions.EmailMask;
    MaskAutoCompleteMode AutoCompleteMode { get; set; } = MaskAutoCompleteMode.Strong;
    char Placeholder { get; set; } = '_';
    bool PlaceholderVisible { get; set; } = false;

    private string spinnerClass = "";

    private async Task GoToNextStep()
    {
        spinnerClass = "spinner-border spinner-border-sm";
        await Task.Delay(500);
        spinnerClass = "";
        await RegModelChanged.InvokeAsync(regModel);
        await onNext.InvokeAsync();
    }

}