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


import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.app.dto.cmd.user.relation.cp.UserCpLightCmd;
import com.red.circle.other.app.service.user.relation.UserCpLightService;
import lombok.AllArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 用户CP点亮 前端控制器.
 * </p>
 *
 * @author zongpubin on 2023-11-16 14:36
 */
@AllArgsConstructor
@RestController
@RequestMapping(value = "/user/cp/light", produces = MediaType.APPLICATION_JSON_VALUE)
public class UserCpLightRestController extends BaseController {

  private final UserCpLightService userCpLightService;

  /**
   * 是否已点亮
   */
  @GetMapping
  public Boolean getCpLight(UserCpLightCmd cmd) {
    return userCpLightService.getCpLight(cmd);
  }

  /**
   * 是否已点亮-两个状态
   */
  @GetMapping("/new")
  public Map<String, Boolean> getCpLightMap(UserCpLightCmd cmd) {
    return userCpLightService.getCpLightMap(cmd);
  }

  /**
   * 点亮CP
   */
  @PostMapping
  public void lightCpUser(@RequestBody @Validated UserCpLightCmd cmd) {
    userCpLightService.lightCpUser(cmd);
  }

  /**
   * 取消点亮CP
   */
  @PostMapping("/cancel")
  public void cancelCpUser(@RequestBody @Validated UserCpLightCmd cmd) {
    userCpLightService.cancelCpUser(cmd);
  }

}
