using System.Threading.Tasks;
using GxPress.Auth;
using GxPress.Common.Page;
using GxPress.Repository.Interface.Visit;
using GxPress.Request.App.Visit;
using GxPress.Result.App.Visit;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace GxPress.Api.AppControllers
{
    /// <summary>
    /// 访问
    /// </summary>
    [Route("/api/app/visit")]
    [ApiController]
    [Authorize]
    public class VisitController : ControllerBase
    {
        private readonly IVisitRepository _visitRepository;
        private readonly ILoginContext _loginContext;
        public VisitController(IVisitRepository visitRepository, ILoginContext loginContext)
        {
            _visitRepository = visitRepository;
            _loginContext = loginContext;
        }
        /// <summary>
        /// 通知查询
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("page")]
        public async Task<PagedList<VisitResult>> GetVisitResultAsync(VisitPageSearchRequest request)
        {
            return await _visitRepository.GetVisitResultAsync(request);
        }
    }
}