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.PropsNobleVipClientService;
import com.red.circle.other.inner.endpoint.material.props.api.PropsNobleVipClientApi;
import com.red.circle.other.inner.model.dto.material.props.NobleVipAbility;
import com.red.circle.other.inner.model.dto.material.props.PropsNobleVipAbilityDTO;
import java.util.List;
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;

/**
 * 贵族vip.
 *
 * @author pengliang on 2023/11/7
 */
@Validated
@RestController
@RequestMapping(value = PropsNobleVipClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class PropsNobleVipClientEndpoint implements PropsNobleVipClientApi {

  private final PropsNobleVipClientService propsNobleVipClientService;

  @Override
  public ResultResponse<PropsNobleVipAbilityDTO> getAbilityDTO(Long sourceId) {
    return ResultResponse.success(propsNobleVipClientService.getAbilityDTO(sourceId));
  }

  @Override
  public ResultResponse<PropsNobleVipAbilityDTO> getUserMaxAbilityDTO(Long userId) {
    return ResultResponse.success(propsNobleVipClientService.getUserMaxAbilityDTO(userId));
  }

  @Override
  public ResultResponse<List<PropsNobleVipAbilityDTO>> listAbilityDTO(Set<Long> sourceIds) {
    return ResultResponse.success(propsNobleVipClientService.listAbilityDTO(sourceIds));
  }

  @Override
  public ResultResponse<Map<Long, PropsNobleVipAbilityDTO>> mapAbilityDTOByIds(
      Set<Long> sourceIds) {
    return ResultResponse.success(propsNobleVipClientService.mapAbilityDTOByIds(sourceIds));
  }

  @Override
  public ResultResponse<Map<Long, NobleVipAbility>> mapAbilityByIds(Set<Long> sourceIds) {
    return ResultResponse.success(propsNobleVipClientService.mapAbilityByIds(sourceIds));
  }

  @Override
  public ResultResponse<Set<Long>> getActualEquityNotExpired(Long userId) {
    return ResultResponse.success(propsNobleVipClientService.getActualEquityNotExpiredVip(userId));
  }

  @Override
  public ResultResponse<Void> addActualEquity(Long userId, Long vipPropsId, Long days) {
    propsNobleVipClientService.addActualEquity(userId, vipPropsId, days);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<Void> addOrUpdateAbility(PropsNobleVipAbilityDTO dto) {
    propsNobleVipClientService.addOrUpdateAbility(dto);
    return ResultResponse.success();
  }

}
