using Blazorise.DataGrid;
using Microsoft.AspNetCore.Components;
using WF_WebAdmin.Model;

namespace WF_WebAdmin.Pages
{
    public partial class ValidQuiz
    {
        private Quiz[] quizzes;
        private int totalQuizzes;

        [Inject]
        public HttpClient Http { get; set; }

        [Inject]
        public NavigationManager NavigationManager { get; set; }

        protected override async Task OnInitializedAsync()
        {
            quizzes = await Http.GetFromJsonAsync<Quiz[]>($"{NavigationManager.BaseUri}fake-dataQuiz.json");
        }

        private void OnValidButton(Quiz quiz)
        {
            ValidateQuiz(quiz);
        }
        
        private void ValidateQuiz(Quiz quiz)
        {
            Console.WriteLine($"Quiz {quiz.Id} validated!");
        }

        private void OnRejectButton(Quiz quiz)
        {
            RejectQuiz(quiz);
        }

        private void RejectQuiz(Quiz quiz)
        {
            Console.WriteLine($"Quiz {quiz.Id} rejected!");
        }
    }
}