using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using New_College.IServices;
using New_College.Model;
using New_College.Model.Models;
using New_College.Model.ViewModels;
using New_College.Model.ViewModels.Query;

namespace New_College.Api.Controllers.Back
{
    [Route("api/back/[controller]/[action]")]
    [ApiController]
    public class VipCardController : ControllerBase
    {
        private readonly IV_VipCardInfoServices iV_VipCardInfoServices;
        private readonly IV_VipCardTypeServices iV_VipCardTypeServices;
        private readonly IV_OrderInfoServices iV_OrderInfoServices;
        public VipCardController(IV_VipCardInfoServices IV_VipCardInfoServices, IV_VipCardTypeServices IV_VipCardTypeServices, IV_OrderInfoServices IV_OrderInfoServices)
        {
            iV_VipCardInfoServices = IV_VipCardInfoServices;
            iV_VipCardTypeServices = IV_VipCardTypeServices;
            iV_OrderInfoServices= IV_OrderInfoServices;
    }
        /// <summary>
        /// 生成卡信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<MessageModel<List<string>>> AutoVipCardInfo([FromBody] AutoVipInfoQuery query)
        {
            return await iV_VipCardInfoServices.AutoVipCardInfo(query);
        }
        /// <summary>
        /// 获取分页
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<MessageModel<PageModel<VipCardInfoResult>>> GetVipCardInfoByPage([FromQuery] VipCardInfoSearchQuery query)
        {
            return await iV_VipCardInfoServices.GetVipCardInfoByPage(query);
        }

        /// <summary>
        /// 获取单个
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<MessageModel<VipCardInfoResultOne>> GetVipCardInfoOne([FromQuery] IdQuery query)
        {
            return await iV_VipCardInfoServices.GetVipCardInfoOne(query);
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<MessageModel<bool>> AddVipCardInfo([FromBody] VipCardInfoQuery query)
        {
            return await iV_VipCardInfoServices.AddVipCardInfo(query);
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<MessageModel<bool>> UpdateVipCardInfo(VipCardInfoQuery query)
        {
            return await iV_VipCardInfoServices.UpdateVipCardInfo(query);
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<MessageModel<bool>> DeleteVipCardInfo([FromBody] IdQuery query)
        {
            return await iV_VipCardInfoServices.DeleteVipCardInfo(query);
        }
        /// <summary>
        /// 获取vipcardTypeList
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<List<VipCardTypeQuery>> GetVipCardType()
        {
            return await iV_VipCardTypeServices.GetVipCardType();
        }
    }
}
