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


import com.github.microservice.models.hxz.*;
import com.github.microservice.net.ResultContent;
import com.zhongshu.card.server.core.service.hxz.HxzService;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("hxz/v1")
@Tag(name = "云版消费机接口-HXZ")
@Hidden
public class HxzController {

    @Autowired
    private HxzService hxzService;

    /**
     * 系统时间
     */
    @Operation(summary = "获取服务器时间接口")
    @PostMapping(value = "ServerTime", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ResultContent serverTime(@RequestBody ServerTimeModel serverTimeModel) {
        return hxzService.serverTime(serverTimeModel);
    }


    @Operation(summary = "用户刷卡综合接口")
    @PostMapping(value = "ConsumTransactions", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ResultContent consumTransactions(@RequestBody ConsumTransactionsModel param) {
        return hxzService.consumTransactions(param);
    }

    @Operation(summary = "用户刷卡消费结果查询接口")
    @PostMapping(value = "orderQuery", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ResultContent orderQuery(@RequestBody OrderQueryModel param) {
        return hxzService.orderQuery(param);
    }

    @Operation(summary = "付款码（二维码）支付接口")
    @PostMapping(value = "QRCodeTransaction", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ResultContent qRCodeTransaction(@RequestBody QRCodeTransactionModel param) {
        return hxzService.qRCodeTransaction(param);
    }

    @Operation(summary = "二维码支付结果查询接口")
    @PostMapping(value = "TransactionInquiry", consumes = MediaType.APPLICATION_JSON_VALUE)
    public ResultContent transactionInquiry(@RequestBody TransactionInquiryModel param) {
        return hxzService.transactionInquiry(param);
    }


}
