using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using System.Net.Http;
using System.Web.Http;
using ExternalDataSync.MOM;

namespace ExternalDataSync.WebAPI.Controller
{
    public class CheckDataController : ApiController
    {
        private readonly string headUrl = "TestPlatform/";

        [HttpPost]
        [Route("TestPlatform/OnlineCheckData")]
        public HttpResponseMessage OnlineCheckData([FromBody] JObject jobj)
        {
            var result = Other.OnlineCheckData(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj);
            return new HttpResponseMessage
            {
                Content = new StringContent(result, Encoding.GetEncoding("UTF-8"), "application/json")
            };
        }

        [HttpPost]
        [Route("TestPlatform/OnlineStatusData")]
        public HttpResponseMessage OnlineStatusData([FromBody] JObject jobj)
        {
            var result = Other.OnlineStatusData(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj);
            return new HttpResponseMessage
            {
                Content = new StringContent(result, Encoding.GetEncoding("UTF-8"), "application/json")
            };
        }

        [HttpPost]
        [Route("TestPlatform/OnlineDewPointResultData")]
        public HttpResponseMessage OnlineDewPointResultData([FromBody] JObject jobj)
        {
            var result = DewPointDataHandler.OnlineDewPointResultData(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj);
            return new HttpResponseMessage
            {
                Content = new StringContent(result, Encoding.GetEncoding("UTF-8"), "application/json")
            };
        }

        [HttpPost]
        [Route("TestPlatform/OnlineDewPointTechnologyData")]
        public HttpResponseMessage OnlineDewPointTechnologyData([FromBody] JObject jobj)
        {
            var result = DewPointDataHandler.OnlineDewPointTechnologyData(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj);
            return new HttpResponseMessage
            {
                Content = new StringContent(result, Encoding.GetEncoding("UTF-8"), "application/json")
            };
        }

        [HttpPost]
        [Route("TestPlatform/OnlineDewPointUseData")]
        public HttpResponseMessage OnlineDewPointUseData([FromBody] JObject jobj)
        {
            var result = DewPointDataHandler.OnlineDewPointUseData(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj);
            return new HttpResponseMessage
            {
                Content = new StringContent(result, Encoding.GetEncoding("UTF-8"), "application/json")
            };
        }

        [HttpPost]
        [Route("TestPlatform/OnlineDewPointStatusData")]
        public HttpResponseMessage OnlineDewPointStatusData([FromBody] JObject jobj)
        {
            var result = DewPointDataHandler.OnlineDewPointStatusData(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj);
            return new HttpResponseMessage
            {
                Content = new StringContent(result, Encoding.GetEncoding("UTF-8"), "application/json")
            };
        }

        /// <summary>
        /// 获取位置待测试产品信息
        /// </summary>
        [HttpPost]
        [Route("TestPlatform/GetWaitCheckProductData")]
        public HttpResponseMessage GetWaitCheckProductData([FromBody] JObject jobj)
        {
            var result = Other.GetWaitCheckProductData(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj);
            return new HttpResponseMessage
            {
                Content = new StringContent(result, Encoding.GetEncoding("UTF-8"), "application/json")
            };
        }
    }
}
