using BPA.KitChen.GroupMeal.Application.BaseDto;
using BPA.KitChen.GroupMeal.Application.Service.OneCard.DiningPlate.Dtos;
using BPA.KitChen.GroupMeal.Application.Service.OneCard.DiningPlate.Service;
using BPA.KitChen.GroupMeal.Core.Common;
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;
using static BPA.KitChen.GroupMeal.Application.Service.AExternalPlatform.Service.DiningPlateService.Dtos.InputDto;

namespace BPA.KitChen.GroupMeal.Application.Service.AExternalPlatform.Service.DiningPlateService
{

    [ApiDescriptionSettings("开放平台", Tag = "餐盘管理"), AllowAnonymous]
    public class DiningPlateServices: IDynamicApiController
    {
        private readonly Service.IDiningPlateService _diningPlateService;

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


        /// <summary>
        ///更具二维码 获取餐盘信息
        /// </summary>
        [HttpPost("/api/ExternalPlatform/DiningPlate/GetDiningPlateInfoByQRCode")]
        public async Task<BPA_DiningPlate> GetDiningPlateInfoByQRCode(DiningPlateQRCodeInputDto inputDto)
        {

            return await _diningPlateService.GetDiningPlateInfoByQRCode(inputDto);


        }

        /// <summary>
        ///更具芯片码 获取餐盘信息
        /// </summary>
        [HttpPost("/api/ExternalPlatform/DiningPlate/GetDiningPlateInfoByChipCode")]
        public async Task<BPA_DiningPlate> GetDiningPlateInfoByChipCode(DiningPlateChipCodeInputDto inputDto)
        {
            return await _diningPlateService.GetDiningPlateInfoByChipCode(inputDto);
        }


        /// <summary>
        /// 根据二维码修改餐盘信息（有就修改没有就新增）
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/DiningPlate/EditDiningPlateByQRCode"), ]
        public async Task<bool> EditDiningPlateByQRCode(DiningPlateCreateOrUpdataDto inputDto)
        {
            return await _diningPlateService.EditDiningPlateByQRCode(inputDto);
        }
    }
}
