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

import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.app.dto.cmd.user.user.UserSpecialIdApplyCmd;
import com.red.circle.other.app.service.user.user.BeautifulNumberApplyService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

/**
 * 申请靓号记录.
 *
 * @author pengliang on 2019/10/23 12:01
 * @eo.api-type http
 * @eo.groupName 用户服务.申请靓号记录
 * @eo.path /user/beautiful-number/apply
 */
@RestController
@RequestMapping(value = "/user/beautiful-number/apply", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class BeautifulNumberApplyRestController extends BaseController {

  private final BeautifulNumberApplyService beautifulNumberApplyService;

  /**
   * 申请靓号.
   *
   * @eo.name 申请靓号.
   * @eo.url
   * @eo.method post
   * @eo.request-type formdata
   */
  @PostMapping
  public void apply(@RequestBody UserSpecialIdApplyCmd cmd) {
    beautifulNumberApplyService.apply(cmd);
  }


  /**
   * 是否存在申请记录.
   *
   * @eo.name 是否存在申请记录.
   * @eo.url /exists
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/exists")
  public Boolean existRecord(AppExtCommand cmd) {
    return beautifulNumberApplyService.existRecord(cmd);
  }

}
