using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using XYY.Common.Standard;
using XYY.Core.Standard.Mvc;
using XYY.Service.Standard.Finance;

namespace XYY.Api.Finance.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class DT_PaymentController : ApiControllerBase
    {
        private readonly IDingTalk_PaymentService _PaymentService;
        public DT_PaymentController(IDingTalk_PaymentService PaymentService) { 
            _PaymentService = PaymentService;
        }
        [AllowAnonymous]
        [HttpGet]
        public async Task<IActionResult> TestCreate(string code)
        {
            await _PaymentService.DingTalkStartProcessEvent(code);
            return Ok();
        }

        [AllowAnonymous]
        [HttpPost]
        public async Task<IActionResult> QueryPage(QueryModel qm)
        {
            if (qm.QueryParamer == null)
                qm.QueryParamer = new System.Collections.Generic.List<QueryParamer>();

            var data = await _PaymentService.QueryPage(qm);
            return Ok(data);
        }
        [AllowAnonymous]
        [HttpGet]
        public async Task<IActionResult> GetPaymentCascadeChoice()
        {
            var data = await _PaymentService.GetPaymentCascadeChoice();
            return Ok(data);
        }

        [AllowAnonymous]
        [HttpGet]
        public async Task<IActionResult> GetPaymentDetails(int PaymentId)
        {
            var data = await _PaymentService.GetPaymentDetails(PaymentId);
            return Ok(data);
        }

    }
}
