package com.cpop.oam.business.controller.callback;

import com.cpop.core.base.entity.R;
import com.cpop.oam.business.bo.CloudUnionCallbackBo;
import com.cpop.oam.framework.enums.CloudCallbackEnums;
import com.cpop.oam.framework.strategy.cloud.CloudCallbackStrategy;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
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 DB
 * @version 1.0.0
 * @since 2024-01-16 11:28
 */
@Tag(name = "云回调controller")
@RestController
@RequestMapping("/callback/cloud")
public class CallbackCloudController {

    /**
     * 云联合回调
     * @author DB
     * @since 2024/1/16
     * @param callback 回调参数
     * @return R<Void>
     */
    //@SimpleSignatureCheck
    @Operation(summary = "云联合回调")
    @PostMapping("/cloudUnionCallback")
    public R<Void> cloudUnionCallback(@RequestBody @Validated CloudUnionCallbackBo callback) {
        CloudCallbackStrategy cloudCallbackStrategy = CloudCallbackEnums.valueOf(callback.getCallbackEnum()).getCloudCallbackStrategy();
        cloudCallbackStrategy.callback(callback);
        return R.ok();
    }
}
