package com.red.circle.other.app.inner.endpoint.material.props;

import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.material.props.BadgeSourceClientService;
import com.red.circle.other.inner.endpoint.material.props.api.BadgeSourceClientApi;
import com.red.circle.other.inner.model.cmd.material.BadgePictureMapQry;
import com.red.circle.other.inner.model.dto.material.BadgeConfigDTO;
import com.red.circle.other.inner.model.dto.material.BadgePictureConfigDTO;
import java.util.Map;
import java.util.Set;
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 pengliang on 2023/6/6
 */
@Validated
@RestController
@RequestMapping(value = BadgeSourceClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class BadgeSourceClientEndpoint implements BadgeSourceClientApi {

  private final BadgeSourceClientService badgeSourceClientService;

  @Override
  public ResultResponse<BadgePictureConfigDTO> getByBadgeId(String sysOrigin, Long badgeId) {
    return ResultResponse.success(badgeSourceClientService.getByBadgeId(sysOrigin, badgeId));
  }

  @Override
  public ResultResponse<Map<Long, BadgePictureConfigDTO>> mapPictureByIds(BadgePictureMapQry qry) {
    return ResultResponse.success(badgeSourceClientService.mapPictureByIds(qry));
  }

  @Override
  public ResultResponse<Map<Long, BadgeConfigDTO>> mapConfigByIds(Set<Long> ids) {
    return ResultResponse.success(badgeSourceClientService.mapConfigByIds(ids));
  }

  @Override
  public ResultResponse<Long> getFreightBadgeId() {
    return ResultResponse.success(badgeSourceClientService.getFreightBadgeId());
  }

}
