using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.Web.Services.Interfaces;

namespace WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateRows
{
    public class CheckListTemplateRowEditPageModel : PageModel
    {
        private readonly ILogger<IndexModel> _logger;
        private readonly IBaseStockService _baseStockService;


        [BindProperty]
        public CheckListTemplateRowDTO CheckListTemplateRow { get; set; }

        [BindProperty]
        public List<SelectListItem> AnswerTypes { get; set; } =
            new[] { "I-N", "P", "SI-N", "I-SN", "PI-N", "I-PN", "V" }
            .Select(x => new SelectListItem { Value = x, Text = x })
            .ToList();

        public CheckListTemplateRowEditPageModel(ILogger<IndexModel> logger, IBaseStockService baseStockService)
        {
            _baseStockService = baseStockService;
            _logger = logger;
        }

        public async Task OnGet(int id)
        {
            CheckListTemplateRow = await _baseStockService.GetCheckListTemplateRow(id);   
        }
    }
}
