using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using XYY.Common.Standard;
using XYY.Core.Standard.Mvc;
using XYY.Service.Standard.TrackingService;
using XYY.ServiceStandard.TrackingService;
using XYY.ServiceStandard.TrackingService.Model;

namespace XYY.API.SINO.Order.Controllers
{
    [Route("api/[controller]/[action]")]
    public class TrackingController : ApiControllerBase
    {
        ITrackingService _trackingService;
        public TrackingController(ITrackingService trackingService)
        {
            _trackingService = trackingService;
        }

        [HttpGet]
        public async Task<IActionResult> Query(string numbers)
        {
            var orderNumbers = numbers.Split(new string[] { Environment.NewLine, "\n", "," }, StringSplitOptions.None)?.ToList();
            var result = await _trackingService.Query(orderNumbers);
            return Ok(result);
        }
    }
}
