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 ReimbursementController : ApiControllerBase
    {
        private readonly IDingTalk_ReimbursementService _ReimbursementService;
        public ReimbursementController(IDingTalk_ReimbursementService ReimbursementService)
        {
            _ReimbursementService = ReimbursementService;
        }
        [AllowAnonymous]
        [HttpPost]
        public async Task<IActionResult> QueryPage(QueryModel qm)
        {
            if (qm.QueryParamer == null)
                qm.QueryParamer = new System.Collections.Generic.List<QueryParamer>();

            var data = await _ReimbursementService.QueryPage(qm);
            return Ok(data);
        }
        [AllowAnonymous]
        [HttpGet]
        public async Task<IActionResult> GetOptionsByType(int OptionType)
        {
            var data = await _ReimbursementService.GetOptionsByType(OptionType);
            return Ok(data);
        }
        [AllowAnonymous]
        [HttpGet]
        public async Task<IActionResult> GetReimbursementDetails(int ReimbursementId)
        {
            var data = await _ReimbursementService.GetReimbursementDetails(ReimbursementId);
            return Ok(data);
        }
        [AllowAnonymous]
        [HttpGet]
        public async Task<IActionResult> GetReimbursementCascadeChoice()
        {
            var data = await _ReimbursementService.GetReimbursementCascadeChoice();
            return Ok(data);
        }
        [AllowAnonymous]
        [HttpGet]
        public async Task<IActionResult> TestCreate(string code)
        {
            await _ReimbursementService.DingTalkStartProcessEvent(code);
            return Ok();
        }
    }
}
