package cn.iocoder.yudao.module.member.controller.app.storecomplain;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.member.controller.app.storecomplain.vo.AppStoreComplainSaveReqVO;
import cn.iocoder.yudao.module.member.service.storecomplain.StoreComplainService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "用户 App - 投诉")
@RestController
@RequestMapping("/member/store-complain")
@Validated
public class AppStoreComplainController {

    @Resource
    private StoreComplainService storeComplainService;

    @PostMapping("/create")
    @Operation(summary = "创建投诉")
    public CommonResult<Long> createStoreComplain(@Valid @RequestBody AppStoreComplainSaveReqVO createReqVO) {
        return success(storeComplainService.createStoreComplainApp(createReqVO));
    }

    //@PutMapping("/update")
    //@Operation(summary = "更新投诉")
    //@PreAuthorize("@ss.hasPermission('member:store-complain:update')")
    //public CommonResult<Boolean> updateStoreComplain(@Valid @RequestBody StoreComplainSaveReqVO updateReqVO) {
    //    storeComplainService.updateStoreComplain(updateReqVO);
    //    return success(true);
    //}
    //
    //@DeleteMapping("/delete")
    //@Operation(summary = "删除投诉")
    //@Parameter(name = "id", description = "编号", required = true)
    //@PreAuthorize("@ss.hasPermission('member:store-complain:delete')")
    //public CommonResult<Boolean> deleteStoreComplain(@RequestParam("id") Long id) {
    //    storeComplainService.deleteStoreComplain(id);
    //    return success(true);
    //}
    //
    //@GetMapping("/get")
    //@Operation(summary = "获得投诉")
    //@Parameter(name = "id", description = "编号", required = true, example = "1024")
    //@PreAuthorize("@ss.hasPermission('member:store-complain:query')")
    //public CommonResult<StoreComplainRespVO> getStoreComplain(@RequestParam("id") Long id) {
    //    StoreComplainDO storeComplain = storeComplainService.getStoreComplain(id);
    //    return success(BeanUtils.toBean(storeComplain, StoreComplainRespVO.class));
    //}
    //
    //@GetMapping("/page")
    //@Operation(summary = "获得投诉分页")
    //@PreAuthorize("@ss.hasPermission('member:store-complain:query')")
    //public CommonResult<PageResult<StoreComplainRespVO>> getStoreComplainPage(@Valid StoreComplainPageReqVO pageReqVO) {
    //    PageResult<StoreComplainDO> pageResult = storeComplainService.getStoreComplainPage(pageReqVO);
    //    return success(BeanUtils.toBean(pageResult, StoreComplainRespVO.class));
    //}
    //
    //@GetMapping("/export-excel")
    //@Operation(summary = "导出投诉 Excel")
    //@PreAuthorize("@ss.hasPermission('member:store-complain:export')")
    //@OperateLog(type = EXPORT)
    //public void exportStoreComplainExcel(@Valid StoreComplainPageReqVO pageReqVO,
    //          HttpServletResponse response) throws IOException {
    //    pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
    //    List<StoreComplainDO> list = storeComplainService.getStoreComplainPage(pageReqVO).getList();
    //    // 导出 Excel
    //    ExcelUtils.write(response, "投诉.xls", "数据", StoreComplainRespVO.class,
    //                    BeanUtils.toBean(list, StoreComplainRespVO.class));
    //}

}