package edu.whut.trigger.rpc;
import edu.whut.api.IMarketTradeService;
import edu.whut.api.dto.*;
import edu.whut.api.response.Response;
import edu.whut.trigger.basic.MarketTradeService;
import org.apache.dubbo.config.annotation.DubboService;
import lombok.RequiredArgsConstructor;

@DubboService(version = "1.0.0")     // 关键注解
@RequiredArgsConstructor
public class MarketTradeDubboService implements IMarketTradeService {

    private final MarketTradeService marketTradeService;   // 复用现有业务

    @Override
    public Response<LockMarketPayOrderResponseDTO> lockMarketPayOrder(
            LockMarketPayOrderRequestDTO dto) {
        return marketTradeService.lockMarketPayOrder(dto);     // 直接委托原 Controller 逻辑
    }

    @Override
    public Response<SettlementMarketPayOrderResponseDTO> settlementMarketPayOrder(
            SettlementMarketPayOrderRequestDTO dto) {
        return marketTradeService.settlementMarketPayOrder(dto);
    }

    @Override
    public Response<RefundMarketPayOrderResponseDTO> refundMarketPayOrder(
            RefundMarketPayOrderRequestDTO dto) {
        return marketTradeService.refundMarketPayOrder(dto);
    }
}
