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

import com.red.circle.console.app.service.app.user.UserPhotoWallService;
import com.red.circle.console.infra.annotations.OpsOperationReqLog;
import com.red.circle.framework.core.dto.PageCommand;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.inner.model.cmd.user.PhotoWallApprovalTableQryCmd;
import com.red.circle.other.inner.model.dto.user.UserPhotoWallDTO;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户照片墙前端控制器.
 */
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/user/photo/wall", produces = MediaType.APPLICATION_JSON_VALUE)
public class UserPhotoWallRestController extends BaseController {

  private final UserPhotoWallService userPhotoWallService;

  /**
   * 获取用户正常照片墙.
   */
  @GetMapping("/normal/{userId}")
  public List<UserPhotoWallDTO> listUserPhotoWallNormal(@PathVariable("userId") Long userId) {
    return userPhotoWallService.listUserPhotoWallNormal(userId);
  }

  /**
   * 获取用户全部照片墙.
   */
  @GetMapping("/all/{userId}")
  public List<UserPhotoWallDTO> listUserPhotoWall(@PathVariable("userId") Long userId) {
    return userPhotoWallService.listUserPhotoWall(userId);
  }

  /**
   * 用户照片墙分页.
   */
  @GetMapping("/page")
  public PageResult<UserPhotoWallDTO> pageUserPhotoWall(PageCommand query) {
    return userPhotoWallService.pageUserPhotoWall(query);
  }

  /**
   * 用户照片墙审批分页.
   */
  @GetMapping("/page/all")
  public PageResult<UserPhotoWallDTO> pageAllUserPhotoWall(PhotoWallApprovalTableQryCmd query) {
    return userPhotoWallService.pageUserPhotoWall(query);
  }

  /**
   * 删除用户照片墙.
   */
  @OpsOperationReqLog("删除用户照片墙")
  @GetMapping("/del/{id}")
  public void deletePhotoWall(@PathVariable("id") Long id) {
    userPhotoWallService.deleteById(id);
  }
}
