@page "/index"
@using AyCode.Interfaces.StorageHandlers;
@using BlazorAnimation
@using Newtonsoft.Json;
@using TIAMWebApp.Shared.Application.Interfaces
@using TIAMWebApp.Shared.Application.Models.ClientSide;
@using AyCode.Blazor.Components;
@using TIAMWebApp.Shared.Application.Models;
@using TIAMWebApp.Shared.Application.Utility;
@using System.IdentityModel.Tokens.Jwt;
@using TIAMSharedUI.Pages.Components;
@using TIAMSharedUI.Shared
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
@inject NavigationManager NavManager
@inject IUserDataService UserDataService;
@inject IJSRuntime jsRuntime;
@inject ISecureStorageHandler SecureStorageHandler
@inject ISessionService sessionService;
@inject IStringLocalizer<MyResources> localizer;
@inject NavigationManager navManager
@inject LogToBrowserConsole logToBrowserConsole
@inject IWizardProcessor WizardProcessor

<PageTitle>Index</PageTitle>

<AuthComponent />

<HeroSlider></HeroSlider>
<div class="container" style="position: relative; z-index: 2;">
    <div class="row d-flex justify-content-center">
        <div class="col-12 col-lg-6">
            <div class="card bg-white p-3">
                <InputWizard Data=@myModel
                             OnSubmit="SubmitForm"
                             IgnoreReflection="@TransferIgnorList"
                             SubmitButtonText="ButtonSend"
                             TitleResourceString="TransferTitle"
                             SubtitleResourceString="TransferSubtitle"></InputWizard>


            </div>
        </div>
    </div>

</div>


<div class="container" style="align-content: center;">



    <div class="text-center">

        <h1>@localizer.GetString("Index.Title")</h1>
        <h2>@localizer.GetString("Index.Subtitle")</h2>
    </div>

    <div class="row">

        <NavLink class="nav-link col-md-6 col-lg-4 col-12" href="transfer">
            <Animation Effect="@Effect.FadeIn" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
                <div class="card m-3 my-card text-white">
                    <img class="card-img" src="_content/TIAMSharedUI/images/m_transfer.jpg" alt="Card image">
                    <div class="card-img-overlay">

                        <h3 class="card-title">@localizer.GetString("Index.Transfer")</h3>

                        <p class="card-text">@localizer.GetString("Index.Transfer.Desc")</p>

                    </div>
                </div>
            </Animation>
        </NavLink>
        <NavLink class="nav-link col-md-6 col-lg-4 col-12" href="tours">
            <Animation Effect="@Effect.FadeIn" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
                <div class="card m-3 my-card text-white">
                    <img class="card-img" src="_content/TIAMSharedUI/images/m_tour.jpg" alt="Card image">
                    <div class="card-img-overlay">
                        <h3 class="card-title">@localizer.GetString("Index.Tours")</h3>
                        <p class="card-text">@localizer.GetString("Index.Tours.Desc")</p>

                    </div>
                </div>
            </Animation>
        </NavLink>
        <NavLink class="nav-link col-md-6 col-lg-4 col-12" href="clubcards">
            <Animation Effect="@Effect.FadeIn" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
                <div class="card m-3 my-card text-white">
                    <img class="card-img" src="_content/TIAMSharedUI/images/m_restaurant.jpg" alt="Card image">
                    <div class="card-img-overlay">
                        <h3 class="card-title">@localizer.GetString("Index.Clubcards")</h3>
                        <p class="card-text">@localizer.GetString("Index.Clubcards.Desc")</p>

                    </div>
                </div>
            </Animation>
        </NavLink>
    </div>

</div>

@code {

    public TransferWizardModel myModel = new TransferWizardModel();

    public List<string> TransferIgnorList = new List<string>
    {
       "Id",
       "Price",
       "Driver"
    };

    /*protected override void OnAfterRender(bool isFirst)
        {
        message = " Target destination is " + slider.SliderElementId.ToString();
    }*/

    public async Task SubmitForm(object Result)
    {

        
        var transfer = await WizardProcessor.ProcessWizardAsync<TransferWizardModel>(Result.GetType(), Result);
        logToBrowserConsole.LogToBC($"Submitted nested form: {Result.GetType().FullName}");
        navManager.NavigateTo("/transfer2/" + transfer.Id);
    }

}





