package com.cool.store.controller.webb;

import com.cool.store.context.CurrentUserHolder;
import com.cool.store.request.notice.BatchDeletedRequest;
import com.cool.store.request.notice.MatterConfigAddRequest;
import com.cool.store.request.notice.MatterConfigQueryRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.MatterConfigService;
import com.cool.store.vo.LineInfoVO;
import com.cool.store.vo.notice.MatterAndMatterDetailVO;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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;

/**
 * @Author suzhuhong
 * @Date 2025/7/24 16:40
 * @Version 1.0
 */
@RestController
@RequestMapping("/pc/matter/config")
@Api(tags = "PC事项配置")
@Slf4j
public class MatterConfigController {

    @Resource
    MatterConfigService matterConfigService;

    @PostMapping("/add")
    @ApiOperation("新增事项配置")
    public ResponseResult<Integer> addMatterConfig(@RequestBody MatterConfigAddRequest request) {
        return ResponseResult.success(matterConfigService.addMatterConfig(request, CurrentUserHolder.getUser()));
    }

    @PostMapping("/edit")
    @ApiOperation("编辑事项配置")
    public ResponseResult<Integer> editMatterConfig(@RequestBody MatterConfigAddRequest request) {
        return ResponseResult.success(matterConfigService.editMatterConfig(request, CurrentUserHolder.getUser()));
    }


    @PostMapping("/deleteMatterConfig")
    @ApiOperation("批量删除事项配置")
    public ResponseResult<Boolean> addMatterConfig(@RequestBody BatchDeletedRequest request) {
        return ResponseResult.success(matterConfigService.deleteMatterConfig(request.getIds(),   CurrentUserHolder.getUser()));
    }

    @PostMapping("/list")
    @ApiOperation("事项配置列表")
    public ResponseResult<PageInfo<MatterAndMatterDetailVO>> listByCondition(@RequestBody MatterConfigQueryRequest request) {
        return ResponseResult.success(matterConfigService.listByCondition(request));
    }





}
