package com.sckw.payment.controller;

import com.alibaba.fastjson2.JSONObject;
import com.sckw.core.web.response.HttpResult;
import com.sckw.payment.service.WalletService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
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;

/**
 * 通知
 *
 * @author xucaiqin
 * @date 2023-08-28 15:36:48
 */
@Tag(name = "通知", description = "通知")
@Validated
@RestController
@RequestMapping("/notice")
@Slf4j
public class NoticeController {
    @Resource
    private WalletService walletService;

    /**
     * 【接口】用户开户回调
     *
     */
    @Operation(summary = "用户开户回调", description = "用户开户回调")
    @PostMapping("/user")
    public HttpResult createUser(@RequestBody @Valid JSONObject jsonObject) {
        return HttpResult.ok(walletService.userNotice(jsonObject));
    }

    /**
     * 【接口】提现回调通知
     *
     */
    @Operation(summary = "提现回调通知", description = "提现回调通知")
    @PostMapping("/cash")
    public Object cash(@RequestBody @Valid JSONObject jsonObject) {
        return HttpResult.ok(walletService.cashNotice(jsonObject));
    }

    /**
     * 【接口】清分回调通知
     *
     */
    @Operation(summary = "清分回调通知", description = "清分回调通知")
    @PostMapping("/split")
    public Object split(@RequestBody @Valid JSONObject jsonObject) {
        return HttpResult.ok(walletService.splitNotice(jsonObject));
    }

}
