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

import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.activity.ActivityPictureConfigClientService;
import com.red.circle.other.inner.endpoint.activity.api.ActivityPictureConfigClientApi;
import com.red.circle.other.inner.model.cmd.activity.ActivityPictureQryCmd;
import com.red.circle.other.inner.model.dto.activity.ActivityPictureConfigDTO;
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 2024/1/29
 */
@Validated
@RestController
@RequestMapping(value = ActivityPictureConfigClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class ActivityPictureConfigClientEndpoint implements ActivityPictureConfigClientApi {

  private final ActivityPictureConfigClientService activityPictureConfigClientService;

  @Override
  public ResultResponse<PageResult<ActivityPictureConfigDTO>> getActivityPicture(
      ActivityPictureQryCmd query) {
    return ResultResponse.success(activityPictureConfigClientService.getActivityPicture(query));
  }

  @Override
  public ResultResponse<Void> addActivityPicture(ActivityPictureConfigDTO dto) {
    activityPictureConfigClientService.addActivityPicture(dto);
    return ResultResponse.success();
  }

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

  @Override
  public ResultResponse<Void> updateActivityPicture(ActivityPictureConfigDTO dto) {
    activityPictureConfigClientService.updateActivityPicture(dto);
    return ResultResponse.success();
  }
}
