using AyCode.Blazor.Components;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TIAM.Entities.Users;
using TIAM.Models.Dtos.Users;
using TIAMWebApp.Shared.Application.Interfaces;
using TIAMWebApp.Shared.Application.Models;

namespace TIAMSharedUI.Pages
{
    public partial class DbTestComponent
    {
        [Parameter]
        public string EmailAddress
        {
            get;
            set;
        }
        public required List<UserModelDto> Users
        {
            get;
            set;
        }
        [Inject]
        public IUserDataService UserDataService
        {
            get;
            set;
        }
        [Parameter]
        public string Value
        {
            get;
            set;
        }
        [Parameter]
        public EventCallback<string> ValueChanged
        {
            get;
            set;
        }
        protected override async Task OnInitializedAsync()
        {
            Users = (await UserDataService.GetUsersAsync())?.ToList();
        }

        private Task OnValueChanged(ChangeEventArgs e)
        {
            Value = e.Value.ToString();
            DisplayCard();
            return ValueChanged.InvokeAsync(Value);
        }

        private void DisplayCard()
        {

        }
    }
}


