using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using XYY.Core.Standard.Data.Infrastructure;
using XYY.Model.Standard.OrderAddressCheck;
using XYY.Service.Standard.AddressCheck;
using XYY.Authentication.Standard;
namespace Controllers
{
    [Route("api/orderAddress")]
    [ApiController]
    public class OrderAddressCheckController : ControllerBase
    {
        private readonly IAssistantAddressService _assistantAddressService;

        //private readonly IDbConnection _unitOfWork;
        public OrderAddressCheckController(
            IAssistantAddressService assistantAddressService
            //IDbConnection unitOfWork
            )
        {
            //_unitOfWork = unitOfWork;
            _assistantAddressService = assistantAddressService;
        }
        [HttpPost]
        public async Task<RecommendedAddress> GetRecommended(AssistantOrderAddress orderAddress)
        {
            if (User.GetUserContent().IsAuthorization)
            {
                string name = User.GetUserContent().NiceName; 
            }
            return await _assistantAddressService.GetRecommendedAddresses(orderAddress);
        }
    }
}
