using BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto;
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Dtos;
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services;
using BPA.SAAS.Manage.Core.Base;
using Microsoft.AspNetCore.Components.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device
{
    [ApiDescriptionSettings("开放平台", Tag = "设备管理"), AllowAnonymous]
    public class DeviceServices:IDynamicApiController
    {
        IDeviceService _deviceService;
        public DeviceServices(IDeviceService deviceService)
        {
            _deviceService= deviceService;
        }
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Device/GetDevicePageList")]
        public async Task<PageUtil<List<DeviceDto>>> GetDevicePageList(DevicePageInputDto inputDto)
        {
            return await _deviceService.GetDevicePageList(inputDto);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Device/AddDevice")]
        public async Task<bool> AddDevice(DeviceInsertDto dto)
        {
            return await _deviceService.AddDevice(dto);
        }
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Device/UpdateDevice")]
        public async Task<bool> UpdateDevice(DeviceUpateDto dto)
        {
            return await _deviceService.UpdateDevice(dto);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Device/DeleteDevice")]
        public async Task<bool> DeleteDevice(DeviceInfoDelDto ids)
        {
            return await _deviceService.DeleteDevice(ids);
        }
    }
}
