using System.Threading.Tasks;
using wispro.sp.web.Models;
using wispro.sp.web.Services;
using Microsoft.AspNetCore.Components;
using wispro.sp.web.Components;

namespace wispro.sp.web.Pages
{
    public partial class Welcome
    {
        private readonly EditableLink[] _links =
        {
            new EditableLink {Title = "Operation 1", Href = ""},
            new EditableLink {Title = "Operation 2", Href = ""},
            new EditableLink {Title = "Operation 3", Href = ""},
            new EditableLink {Title = "Operation 4", Href = ""},
            new EditableLink {Title = "Operation 5", Href = ""},
            new EditableLink {Title = "Operation 6", Href = ""}
        };

        private ActivitiesType[] _activities = { };
        private NoticeType[] _projectNotice = { };
        private CurrentUser _CurrentUser;

        [Inject] public IProjectService ProjectService { get; set; }
        [Inject] public IUserService _userService { get; set; }

        protected override async System.Threading.Tasks.Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();
            _CurrentUser = _userService.CurrentUser;
            _projectNotice = await ProjectService.GetProjectNoticeAsync();
            _activities = await ProjectService.GetActivitiesAsync();

            foreach(ActivitiesType at in _activities)
            {
                System.Diagnostics.Debug.WriteLine(at.User.Name);
            }
        }
    }
}
