using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Nop.Plugin.Misc.SignalRApi.Hubs;

namespace Nop.Plugin.Misc.SignalRApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class ProductOfferController : ControllerBase
    {
        private IHubContext<MainHub, IMainHubClient> mainHub;
        public ProductOfferController(IHubContext<MainHub, IMainHubClient> _mainHub)
        {
            mainHub = _mainHub;
        }
        [HttpPost]
        [Route("productoffers")]
        public string Get()
        {
            List<string> offers = new List<string>();
            offers.Add("20% Off on IPhone 12");
            offers.Add("15% Off on HP Pavillion");
            offers.Add("25% Off on Samsung Smart TV");
            //mainHub.Clients.All.SendOffersToUser(offers);
            return "Offers sent successfully to all users!";
        }
    }
}
