using Knoks.Core.Data.Interfaces;
using Knoks.Core.Entities;
using Knoks.Framework.DataAccess;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Knoks.Core.Entities;
using System.Linq;

namespace Knoks.Core.Data.Dao
{
    public class KnokPriceDao : IKnokPriceDao
    {
        private readonly IProcExecutor _executor;
        private ILogger<KnokPriceDao> _logger;
        private readonly IUserDao _userDao;
        private readonly IKnokDao knokDao;


        public const double objective = 0.75;
        public const int cm = 100;
        public KnokPriceDao(ILogger<KnokPriceDao> logger, IProcExecutor executor, IKnokDao knokDao, IUserDao userDao)
        {
            _logger = logger;
            _userDao = userDao;
            _executor = executor;
            this.knokDao = knokDao;
        }

        public async Task<decimal> GetProbabilityOfWinning(long userId)
        {
            var result = await _executor.Go("GetProbabilityOfWinning", new { UserId = userId });
            return result.ReturnValue.Value;
        }

        public async Task<decimal> GetWinPayoff(long userId)
        {
            var result = await _executor.Go("GetWinPayoff", new { UserId = userId });
            return result.ReturnValue.Value;
        }

        public async Task<decimal> GetLossPayoff(long userId)
        {
            var result = await _executor.Go("GetLossPayoff", new { UserId = userId });
            return result.ReturnValue.Value;
        }
    }
}
