package com.red.circle.other.app.inner.endpoint.sys;

import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.sys.SysGiftPackClientService;
import com.red.circle.other.inner.endpoint.sys.api.SysGiftPackClientApi;
import com.red.circle.other.inner.model.cmd.sys.GiftPackQryCmd;
import com.red.circle.other.inner.model.dto.sys.SysGiftPackDTO;
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;

/**
 * 礼包
 *
 * @author zongpubin on 2023/11/1
 */
@Validated
@RestController
@RequestMapping(value = SysGiftPackClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class SysGiftPackClientEndpoint implements SysGiftPackClientApi {

  private final SysGiftPackClientService giftPackClientService;

  @Override
  public ResultResponse<PageResult<SysGiftPackDTO>> getGiftPackInfo(GiftPackQryCmd query) {
    return ResultResponse.success(giftPackClientService.getGiftPackInfo(query));
  }

  @Override
  public ResultResponse<Void> addGiftPack(SysGiftPackDTO sysGiftPackDTO) {
    giftPackClientService.addGiftPack(sysGiftPackDTO);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<Void> updateGiftPack(SysGiftPackDTO sysGiftPackDTO) {
    giftPackClientService.updateGiftPack(sysGiftPackDTO);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<Void> deleteGiftPack(Long id) {
    giftPackClientService.deleteGiftPack(id);
    return ResultResponse.success();
  }
}
