package com.red.circle.external.inner.endpoint.binance;

import com.red.circle.external.inner.endpoint.binance.api.BinanceClientApi;
import com.red.circle.external.inner.endpoint.censor.api.CensorImageClientApi;
import com.red.circle.external.inner.service.binance.BinanceClientService;
import com.red.circle.framework.dto.ResultResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

/**
 * 图片安全鉴定.
 *
 * @author pengliang on 2023/10/17
 */
@Validated
@RestController
@RequestMapping(value = CensorImageClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class BinanceClientEndpoint implements BinanceClientApi {

    private final BinanceClientService binanceClientService;

    @Override
    public ResultResponse<String> depositHistory(String txId) {
        return ResultResponse.success(binanceClientService.depositHistory(txId));
    }

    @Override
    public ResultResponse<String> transactions(String orderId)
            throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException {
        return ResultResponse.success(binanceClientService.transactions(orderId));
    }
}
