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

import com.github.microservice.net.ResultContent;
import com.zhongshu.card.client.openApi.model.ExpenseFlowOpenApiModel;
import com.zhongshu.card.client.openApi.params.ExpenseFlowOpenApiSearch;
import com.zhongshu.card.client.openApi.params.PaymentNoParam;
import com.zhongshu.card.server.core.service.openAPI.ExpenseFlowOpenApiService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author TRX
 * @date 2024/6/5
 */
@RestController
@RequestMapping("/openAPI/v1/orderManager")
@Tag(name = "openAPI-订单管理")
public class ExpenseFlowOpenApiController {

    @Autowired
    private ExpenseFlowOpenApiService expenseFlowOpenApiService;

    @Operation(summary = "订单列表-分页查询", description = "订单列表-分页查询")
    @RequestMapping(value = {"page"}, method = {RequestMethod.POST})
    public ResultContent<Page<ExpenseFlowOpenApiModel>> page(@RequestBody ExpenseFlowOpenApiSearch param) {
        return expenseFlowOpenApiService.page(param);
    }

    @Operation(summary = "订单详情", description = "订单详情")
    @RequestMapping(value = {"getDetailByPaymentNo"}, method = {RequestMethod.POST})
    public ResultContent<ExpenseFlowOpenApiModel> getDetailByPaymentNo(@RequestBody PaymentNoParam param) {
        return expenseFlowOpenApiService.getDetailByPaymentNo(param);
    }

    @Operation(summary = "关闭订单", description = "关闭订单")
    @RequestMapping(value = {"closeOrder"}, method = {RequestMethod.POST})
    public ResultContent<ExpenseFlowOpenApiModel> closeOrder(@RequestBody PaymentNoParam param) {
        return expenseFlowOpenApiService.closeOrder(param);
    }

}
