using BPA.KitChen.GroupMeal.Application.BaseDto;
using BPA.KitChen.GroupMeal.Application.Service.AExternalPlatform.Service.DiningPlateService.Dtos;
using BPA.KitChen.GroupMeal.Application.Service.OneCard.DiningPlate.Dtos;
using BPA.KitChen.GroupMeal.Application.Service.OneCard.DiningPlate.Service;
using BPA.KitChen.GroupMeal.Core.Entity;
using BPA.KitChen.GroupMeal.Core.Enum;
using BPA.KitChen.GroupMeal.SqlSugar;
using Furion.DatabaseAccessor;
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMeal.Application.Service.OneCard.DiningPlate
{

    [ApiDescriptionSettings("餐盘管理", Tag = "餐盘管理")]
    public class DiningPlateServices: IDynamicApiController
    {
        private readonly IDiningPlateService _diningPlateService;

        public DiningPlateServices(IDiningPlateService diningPlateService)
        {
            _diningPlateService = diningPlateService;
        }


        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/DiningPlate/Page")]
        public async Task<PageUtil> Page(DiningPlatePageIndexDto inputDto)
        {
            return await _diningPlateService.Page(inputDto);
        }

        /// <summary>
        /// 新增餐盘 
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/DiningPlate/Add")]
        public async Task<bool> Add(DiningPlateCreateOrUpdataDto inputDto)
        {
            return await _diningPlateService.Add(inputDto);
        }


        /// <summary>
        /// 修改餐盘
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/DiningPlate/Update")]
        public async Task<bool> Update(DiningPlateCreateOrUpdataDto inputDto)
        {
            return await _diningPlateService.Update(inputDto);
        }


        /// <summary>
        /// 启用警用
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/DiningPlate/EnableDisable")]
        public async Task<bool> EnableDisable(DiningPlateCreateOrUpdataDto inputDto)
        {
            return await _diningPlateService.EnableDisable(inputDto);
        }

        

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpPost("/api/DiningPlate/Del")]
        public async Task<bool> Del(string id)
        {
            return await _diningPlateService.Del(id);
        }

        /// <summary>
        /// 解除占用
        /// </summary>
        /// <returns></returns>
        [HttpPost("/api/DiningPlate/UnbindOccupy")]
        public async Task<bool> UnbindOccupy(List<DiningPlateOccupyDto> inputDto)
        {
            return await _diningPlateService.UnbindOccupy(inputDto);
        }

        /// <summary>
        /// 获取餐盘信息
        /// </summary>
        /// <param name="diningPlateId"></param>
        /// <returns></returns>
        [HttpPost("/api/DiningPlate/GetDiningPlateInfo")]
        public async Task<List<DiningPlateDto>> GetDiningPlateInfo(List<string> inputDto)
        {
            return await _diningPlateService.GetDiningPlateInfo(inputDto);
        }

        [HttpPost("/api/DiningPlate/GetDiningPlateInfoByQRCode"), AllowAnonymous]
        public async Task<DiningPlateDto> GetDiningPlateInfoByQRCode(GetDiningPlateInfoByQRCodeDto inputDto)
        {
            return await _diningPlateService.GetDiningPlateInfoByQRCode(inputDto);
        }


        /// <summary>
        /// 根据芯片码获取  餐盘
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/DiningPlate/GetDiningPlateInfoByChipCodeList"), AllowAnonymous]
        public async Task<List<DiningPlateDto>> GetDiningPlateInfoByChipCodeList(
            GetDiningPlateInfoByChipCodeListDto inputDto)
        {
            return await _diningPlateService.GetDiningPlateInfoByChipCodeList(inputDto);
        }


        /// <summary>
        /// 获取餐盘信息更具id
        /// </summary>
        /// <param name="diningPlateId"></param>
        /// <returns></returns>
        [HttpPost("/api/DiningPlate/GetDiningPlateInfoById"), AllowAnonymous]
        public async Task<DiningPlateDto> GetDiningPlateInfoById(GetDiningPlateInfoByIdDto inputDto)
        {
            return await _diningPlateService.GetDiningPlateInfoById(inputDto);
        }

    }
}
