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

import com.red.circle.framework.core.dto.CommonCommand;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.app.dto.clientobject.user.user.UserExpandProfileCO;
import com.red.circle.other.app.dto.cmd.user.user.LanguageUploadCmd;
import com.red.circle.other.app.service.user.user.UserExpandService;
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/5/31
 * @eo.api-type http
 * @eo.groupName 用户服务.扩展信息
 * @eo.path /user/expand
 */
@Validated
@RestController
@RequestMapping(value = "/user/expand", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class UserExpandRestController extends BaseController {

  private final UserExpandService userExpandService;

  /**
   * 上传使用语言.
   *
   * @eo.name 上传使用语言.
   * @eo.url /upload/language
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/upload/language")
  public void language(@Validated LanguageUploadCmd cmd) {
    userExpandService.uploadLanguage(cmd);
  }

  /**
   * 获取我的扩展信息.
   *
   * @eo.name 获取我的扩展信息.
   * @eo.url /profile
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/profile")
  public UserExpandProfileCO getUserExpand(CommonCommand cmd) {
    return userExpandService.getUserExpand(cmd);
  }

}
