package com.red.circle.order.inner.endpoint;

import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.order.inner.endpoint.api.OrderOtherRechargeClientClientApi;
import com.red.circle.order.inner.model.cmd.inapp.OrderOtherRechargePageQryCmd;
import com.red.circle.order.inner.model.dto.inapp.OrderOtherRechargeDTO;
import com.red.circle.order.inner.service.OrderOtherRechargeClientService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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;

/**
 * 其他充值订单.
 *
 * @author pengliang on 2023/11/3
 */
@Slf4j
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping(value = OrderOtherRechargeClientClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
public class OrderOtherRechargeClientClientEndpoint implements OrderOtherRechargeClientClientApi {

  private final OrderOtherRechargeClientService orderOtherRechargeClientService;

  @Override
  public ResultResponse<Void> add(OrderOtherRechargeDTO order) {
    orderOtherRechargeClientService.add(order);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<PageResult<OrderOtherRechargeDTO>> pageOps(
      OrderOtherRechargePageQryCmd qryCmd) {
    return ResultResponse.success(orderOtherRechargeClientService.pageOps(qryCmd));
  }
}
