package com.zhongshu.card.server.core.controller.openAPI;

import com.github.microservice.pay.client.model.ledger.TransactionLogModel;
import com.github.microservice.pay.client.model.ledger.transaction.TransactionLogPeriodAggregateRetModel;
import com.github.microservice.pay.client.model.ledger.transaction.TransactionLogRealTimeAggregateRetModel;
import com.github.microservice.pay.client.model.ledger.transaction.TransactionLogSettleAggregateRetModel;
import com.github.microservice.pay.client.ret.ResultContent;
import com.github.microservice.staticVariable.OpenApiMark;
import com.zhongshu.card.client.model.pay.PeriodDetailQueryModel;
import com.zhongshu.card.client.model.pay.PeriodQueryModel;
import com.zhongshu.card.client.model.pay.SettleDetailQueryModel;
import com.zhongshu.card.server.core.service.pay.OrgOverviewService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/" + OpenApiMark.fullCardOpenAPI + "/v1/transactionLog")
@Tag(name = "openAPI-账单")
public class TransactionLogOpenApiController {

    @Autowired
    OrgOverviewService orgOverviewService;

    @Operation(summary = "查询收入账单", description = "查询收入账单-年月日汇总")
    @RequestMapping(value = "queryCreditBill", method = RequestMethod.POST)
    public ResultContent<Page<TransactionLogPeriodAggregateRetModel>> queryCreditBill(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable,
            @Parameter(required = true) PeriodQueryModel param) {
        return orgOverviewService.queryCreditBill(pageable, param);
    }

    @Operation(summary = "查询收入账单详情", description = "查询收入账单详情")
    @RequestMapping(value = "queryCreditBillDetail", method = RequestMethod.POST)
    public ResultContent<Page<TransactionLogModel>> queryCreditBillDetail(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable,
            @Parameter(required = true) PeriodDetailQueryModel periodDetailQueryModel) {
        return orgOverviewService.queryCreditBillDetail(pageable, periodDetailQueryModel);
    }

    @Operation(summary = "查询结算账单", description = "查询结算账单")
    @RequestMapping(value = "querySettleBill", method = RequestMethod.POST)
    public ResultContent<Page<TransactionLogSettleAggregateRetModel>> querySettleBill(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable,
            @Parameter(required = false) PeriodQueryModel param) {
        return orgOverviewService.querySettleBill(pageable, param);
    }

    @Operation(summary = "查询结算账单详情", description = "查询结算账单详情")
    @RequestMapping(value = "querySettleBillDetail", method = RequestMethod.POST)
    public ResultContent<Page<TransactionLogModel>> querySettleBillDetail(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable,
            @Parameter(required = false) SettleDetailQueryModel settleDetailQueryModel) {
        return orgOverviewService.querySettleBillDetail(pageable, settleDetailQueryModel);
    }

    @Operation(summary = "查询提现账单", description = "查询提现账单")
    @RequestMapping(value = "queryWithdrawBill", method = RequestMethod.POST)
    public ResultContent<Page<TransactionLogRealTimeAggregateRetModel>> queryWithdrawBill(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable,
            @Parameter(required = false) PeriodQueryModel param) {
        return orgOverviewService.queryWithdrawBill(pageable, param);
    }

    @Operation(summary = "查询提现账单详情", description = "查询提现账单详情")
    @RequestMapping(value = "queryWithdrawBillDetail", method = RequestMethod.POST)
    public ResultContent<Page<TransactionLogModel>> queryWithdrawBillDetail(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable,
            @Parameter(required = false) SettleDetailQueryModel settleDetailQueryModel) {
        return orgOverviewService.queryWithdrawBillDetail(pageable, settleDetailQueryModel);
    }
}
