package com.starry.admin.modules.clerk.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.starry.admin.modules.clerk.module.vo.PlayClerkDataReviewQueryVo;
import com.starry.admin.modules.clerk.module.vo.PlayClerkDataReviewReturnVo;
import com.starry.admin.modules.clerk.module.vo.PlayClerkDataReviewStateEditVo;
import com.starry.admin.modules.clerk.service.IPlayClerkDataReviewInfoService;
import com.starry.common.annotation.Log;
import com.starry.common.enums.BusinessType;
import com.starry.common.result.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 店员资料审核Controller
 *
 * @author admin
 * @since 2024-05-19
 */
@Api(tags = "店员资料内容审核", description = "店员资料内容审核相关接口，包括昵称、头像、相册、录音等资料的审核")
@RestController
@RequestMapping("/clerk/data/review")
public class PlayClerkDataReviewInfoController {

    @Resource
    private IPlayClerkDataReviewInfoService playClerkDataReviewInfoService;

    /**
     * 查询店员资料审核列表
     */
    @ApiOperation(value = "查询资料审核列表", notes = "分页查询店员资料审核列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "操作成功", response = PlayClerkDataReviewReturnVo.class, responseContainer = "Page")})
    @PostMapping("/listByPage")
    public R list(@ApiParam(value = "查询条件", required = true) @Validated @RequestBody PlayClerkDataReviewQueryVo vo) {
        IPage<PlayClerkDataReviewReturnVo> list = playClerkDataReviewInfoService.selectByPage(vo);
        return R.ok(list);
    }

    /**
     * 修改店员资料审核
     */
    @ApiOperation(value = "修改资料审核状态", notes = "更新店员资料审核状态，通过或拒绝")
    @ApiResponses({@ApiResponse(code = 200, message = "操作成功")})
    // @PreAuthorize("@customSs.hasPermission('clerk:dataReview:update')")
    @Log(title = "店员资料审核", businessType = BusinessType.UPDATE)
    @PostMapping(value = "/update")
    public R update(
            @ApiParam(value = "审核状态信息", required = true) @Validated @RequestBody PlayClerkDataReviewStateEditVo vo) {
        playClerkDataReviewInfoService.updateDataReviewState(vo);
        return R.ok();
    }

    /**
     * 删除店员资料审核
     */
    @ApiOperation(value = "删除资料审核记录", notes = "根据ID批量删除店员资料审核记录")
    @ApiImplicitParam(name = "ids", value = "审核记录ID数组", required = true, paramType = "path", dataType = "String[]", example = "1,2,3")
    @ApiResponses({@ApiResponse(code = 200, message = "操作成功", response = Integer.class)})
    // @PreAuthorize("@customSs.hasPermission('clerk:dataReview:delete')")
    @Log(title = "店员资料审核", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public R remove(@PathVariable String[] ids) {
        return R.ok(playClerkDataReviewInfoService.deletePlayClerkDataReviewInfoByIds(ids));
    }
}
