package com.red.circle.other.adapter.app.user.user;

import com.red.circle.common.business.core.level.UserLevelExperience;
import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd;
import com.red.circle.other.app.dto.clientobject.user.user.UserLevelCO;
import com.red.circle.other.app.dto.cmd.user.user.UserLevelCmd;
import com.red.circle.other.app.service.user.user.UserLevelService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户等级, 服务.
 *
 * @author pengliang on 2021/1/18
 * @eo.api-type http
 * @eo.groupName 用户服务.用户等级
 * @eo.path /user/user-level
 */
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/user/user-level", produces = MediaType.APPLICATION_JSON_VALUE)
public class UserLevelRestController {

  private final UserLevelService userLevelService;

  /**
   * 获取用户消费等级（财富&魅力）.
   *
   * @eo.name 获取用户消费等级（财富&魅力）.
   * @eo.url /consumption
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/consumption")
  public UserLevelCO getUserLevelByUserId(@Validated AppUserIdCmd cmd) {
    return userLevelService.getConsumptionLevelByUserId(cmd);
  }

  /**
   * 获取用户等级, 经验.
   *
   * @eo.name 获取用户等级, 经验.
   * @eo.url /consumption/exp
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/consumption/exp")
  public UserLevelExperience getUserLevelExperience(@Validated UserLevelCmd cmd) {
    return userLevelService.getLevelExperience(cmd);
  }

}
