﻿using HockeyApp.Models.Users;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using HockeyApp.Services.News.Contracts;

namespace HockeyApp.WebApi.Controllers.Posts
{
    /// <summary>
    /// Контроллер новостей
    /// </summary>
    [Route("v1/posts")]
    public class PostsController : Controller
    {
        private readonly IPostService _postService;
        private readonly UserManager<User> _userManager;

        public PostsController(IPostService postsService)
        {
            _postService = postsService;
        }

        ///// <summary>
        ///// Проголосовать за пост
        ///// </summary>
        ///// <param name="id">id поста</param>
        ///// <returns></returns>
        //[HttpPost]
        //[Route("{id}/voteup")]
        //[Authorize]
        //public async Task<IActionResult> VoteUp(long id)
        //{
        //    var userId = await _userManager.GetUserIdAsync(User);
        //    await _postService.VoteForPost(id, userId, true);
        //    return Ok();
        //}

        ///// <summary>
        ///// Проголосовать против поста
        ///// </summary>
        ///// <param name="id">id поста</param>
        ///// <returns></returns>
        //[HttpPost]
        //[Route("{id}/votedown")]
        //[Authorize]
        //public async Task<IActionResult> VoteDown(long id)
        //{
        //    var userId = await _userManager.GetUserIdAsync(User);
        //    await _postService.VoteForPost(id, userId, true);
        //    return Ok();
        //}
    }
}
