package com.red.circle.game.fruit.adapter.endpoint;

import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.game.fruit.application.endpoint.GameFruitTaskClientService;
import com.red.circle.game.fruit.inner.endpoint.api.GameFruitTaskClientApi;
import com.red.circle.game.fruit.inner.model.cmd.GameFruitBountyConfigQryCmd;
import com.red.circle.game.fruit.inner.model.cmd.GameFruitTaskConfigQryCmd;
import com.red.circle.game.fruit.inner.model.dto.GameFruitAwardPictureDTO;
import com.red.circle.game.fruit.inner.model.dto.GameFruitBountyConfigDTO;
import com.red.circle.game.fruit.inner.model.dto.GameFruitTaskConfigDTO;
import java.util.List;
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/12/13
 */
@Validated
@RestController
@RequestMapping(value = GameFruitTaskClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class GameFruitTaskClientEndpoint implements GameFruitTaskClientApi {

  private final GameFruitTaskClientService gameFruitTaskClientService;

  @Override
  public ResultResponse<PageResult<GameFruitBountyConfigDTO>> getGameFruitBountyConfig(
      GameFruitBountyConfigQryCmd query) {
    return ResultResponse.success(gameFruitTaskClientService.getGameFruitBountyConfig(query));
  }

  @Override
  public ResultResponse<Void> addGameFruitBountyConfig(GameFruitBountyConfigDTO param) {
    gameFruitTaskClientService.addGameFruitBountyConfig(param);
    return ResultResponse.success();
  }

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

  @Override
  public ResultResponse<PageResult<GameFruitTaskConfigDTO>> getGameFruitTaskConfig(
      GameFruitTaskConfigQryCmd query) {
    return ResultResponse.success(gameFruitTaskClientService.getGameFruitTaskConfig(query));
  }

  @Override
  public ResultResponse<Void> addGameFruitTaskConfig(GameFruitTaskConfigDTO param) {
    gameFruitTaskClientService.addGameFruitTaskConfig(param);
    return ResultResponse.success();
  }

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

  @Override
  public ResultResponse<List<GameFruitAwardPictureDTO>> getGameFruitImages(String sysOrigin) {
    return ResultResponse.success(gameFruitTaskClientService.getGameFruitImages(sysOrigin));
  }
}
