package com.ningdatech.kqapi.zzsfw.controller;


import com.ningdatech.basic.model.ApiResponse;
import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwMattersDeduplicateDTO;
import com.ningdatech.kqapi.zzsfw.entity.dto.NdKqZzsfwMenuDTO;
import com.ningdatech.kqapi.zzsfw.entity.vo.MatterTopVO;
import com.ningdatech.kqapi.zzsfw.entity.vo.MattersVO;
import com.ningdatech.kqapi.zzsfw.entity.vo.TreeVO;
import com.ningdatech.kqapi.zzsfw.manage.MatterManage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ZPF
 * @since 2023-10-27
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/api/v1/zzsfw/")
@Api(value = "NdKqZzsfwMenuController", tags = "柯桥-政务数据")
@RequiredArgsConstructor
public class NdKqZzsfwMenuController {
    private final MatterManage matterManage;

    @ApiOperation(value = "获取政务事项数据列表", notes = "获取政务事项数据列表")
    @GetMapping("/matters")
    public List<TreeVO> getMatters() {
        return matterManage.getMatters();
    }

    @ApiOperation(value = "top10事项", notes = "top10事项")
    @GetMapping("/top10")
    public List<MatterTopVO> topTen() {
        return matterManage.topTen();
    }

    @ApiOperation(value = "政务事项数据保存", notes = "政务事项数据保存")
    @PostMapping("/save")
    public String save(@RequestBody NdKqZzsfwMenuDTO dto) {
        return matterManage.save(dto);
    }

    @ApiOperation(value = "政务事项数据清空", notes = "政务事项数据清空")
    @GetMapping("/remove-all")
    public String removeAll() {
        return matterManage.removeAll();
    }

    @ApiOperation(value = "政务事项去重保存", notes = "政务事项去重保存")
    @PostMapping("/save-dup")
    public String saveDup(@RequestBody NdKqZzsfwMattersDeduplicateDTO dto) {
        return matterManage.saveDup(dto);
    }

    @ApiOperation(value = "政务事项数据清空", notes = "政务事项数据清空")
    @GetMapping("/remove-all-dup")
    public String removeAllDup() {
        return matterManage.removeAllDup();
    }
}
