using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using wispro.sp.entity;
using wispro.sp.web.Services;

namespace wispro.sp.web.Components
{
    public partial class UserGradeSelect
    {
        private List<StaffGrade> _StaffGrades;
        private StaffGrade _SelectedItem;

        [Inject] StaffGradeService _staffGradeService{get;set;}

        [Parameter]
        public int? StaffGradeId { get; set; }


        [Parameter]
        public EventCallback<int?> StaffGradeIdChanged { get; set; }

        protected override async System.Threading.Tasks.Task OnInitializedAsync()
        {
            base.OnInitialized();

            _StaffGrades = await _staffGradeService.GetAll();
        }

        private void OnSelectedItemChangedHandler(StaffGrade value)
        {
            _SelectedItem = value;
            StaffGradeIdChanged.InvokeAsync(_SelectedItem.Id);
        }
    }
}
