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

import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.common.business.dto.cmd.UserIdCmd;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.app.dto.clientobject.user.user.SysExchangeGoldTableCO;
import com.red.circle.other.app.dto.clientobject.user.user.UserRegionCO;
import com.red.circle.other.app.service.user.user.UserRegionService;
import java.util.List;
import java.util.Map;
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 2023/6/11
 * @eo.api-type http
 * @eo.groupName 用户服务.用户区域
 * @eo.path /user/user-region
 */
@RestController
@RequestMapping(value = "/user/user-region", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class UserRegionRestController extends BaseController {

  private final UserRegionService userRegionService;

  /**
   * 获取用户code.
   *
   * @eo.name 获取用户code.
   * @eo.url
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping
  public UserRegionCO getUserRegionSetting(@Validated UserIdCmd cmd) {
    return userRegionService.getUserRegionSetting(cmd);
  }

  /**
   * 获得用户区域Metadata.
   *
   * @eo.name 获得用户区域Metadata.
   * @eo.url /metadata
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/metadata")
  public Map<String, String> getUserRegionMetadata(AppExtCommand cmd) {
    return userRegionService.getUserRegionMetadata(cmd);
  }

  /**
   * 获得用户区域钻石Metadata.
   *
   * @eo.name 获得用户区域钻石Metadata.
   * @eo.url /metadata
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/diamond-metadata")
  public Map<String, String> getUserRegionDiamondMetadata(AppExtCommand cmd) {
    return userRegionService.getUserRegionDiamondMetadata(cmd);
  }

  /**
   * 获得获得区域银行钱包兑换金币比例列表.
   *
   * @eo.name 获得获得区域银行钱包兑换金币比例列表.
   * @eo.url /exchange-gold/table
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/exchange-gold/table")
  public List<SysExchangeGoldTableCO> listRegionExchangeGoldTip(AppExtCommand cmd) {
    return userRegionService.listRegionExchangeGoldTable(cmd);
  }

}
