using HoneyBox.Admin.Business.Attributes;
using HoneyBox.Admin.Business.Models.Finance;
using HoneyBox.Admin.Business.Services.Interfaces;
using Microsoft.AspNetCore.Mvc;

namespace HoneyBox.Admin.Business.Controllers;

/// <summary>
/// 财务管理控制器
/// </summary>
[Route("api/admin/business/finance")]
public class FinanceController : BusinessControllerBase
{
    private readonly IFinanceService _financeService;

    public FinanceController(IFinanceService financeService)
    {
        _financeService = financeService;
    }

    /// <summary>
    /// 获取消费排行榜
    /// </summary>
    /// <param name="request">查询请求</param>
    /// <returns>消费排行榜</returns>
    [HttpGet("ranking")]
    [BusinessPermission("finance:view")]
    public async Task<IActionResult> GetConsumptionRanking([FromQuery] FinanceQueryRequest request)
    {
        var result = await _financeService.GetConsumptionRankingAsync(request);
        return Ok(result);
    }

    /// <summary>
    /// 获取余额明细
    /// </summary>
    /// <param name="request">查询请求</param>
    /// <returns>余额明细列表</returns>
    [HttpGet("balance")]
    [BusinessPermission("finance:view")]
    public async Task<IActionResult> GetBalanceDetails([FromQuery] FinanceQueryRequest request)
    {
        var result = await _financeService.GetBalanceDetailsAsync(request);
        return Ok(result);
    }

    /// <summary>
    /// 获取积分明细
    /// </summary>
    /// <param name="request">查询请求</param>
    /// <returns>积分明细列表</returns>
    [HttpGet("integral")]
    [BusinessPermission("finance:view")]
    public async Task<IActionResult> GetIntegralDetails([FromQuery] FinanceQueryRequest request)
    {
        var result = await _financeService.GetIntegralDetailsAsync(request);
        return Ok(result);
    }

    /// <summary>
    /// 获取钻石明细
    /// </summary>
    /// <param name="request">查询请求</param>
    /// <returns>钻石明细列表</returns>
    [HttpGet("score")]
    [BusinessPermission("finance:view")]
    public async Task<IActionResult> GetScoreDetails([FromQuery] FinanceQueryRequest request)
    {
        var result = await _financeService.GetScoreDetailsAsync(request);
        return Ok(result);
    }

    /// <summary>
    /// 获取充值记录
    /// </summary>
    /// <param name="request">查询请求</param>
    /// <returns>充值记录列表</returns>
    [HttpGet("recharge")]
    [BusinessPermission("finance:view")]
    public async Task<IActionResult> GetRechargeRecords([FromQuery] FinanceQueryRequest request)
    {
        var result = await _financeService.GetRechargeRecordsAsync(request);
        return Ok(result);
    }
}
