using BusinessLayer.IRepository;
using BusinessLayer.Repository;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.OData.Query;
using System.Data;

namespace API.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class ExamQuestionController : ControllerBase
    {
        private IExamQuestionRepository _examQuestionRepository;

        public ExamQuestionController(IExamQuestionRepository examQuestionRepository)
        {
            _examQuestionRepository = examQuestionRepository;
        }

        [HttpGet("{examId}")]
        [EnableQuery]
        [Authorize(AuthenticationSchemes = "Bearer", Roles = "1")]
        public IActionResult Get(int examId)
        {
            return Ok(_examQuestionRepository.GetAllExamQuestions(examId));
        }
    }
}
