package com.unis.policy.info.modular.alPolicyFileReport.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.unis.sys.modular.org.entity.SysOrg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.unis.common.annotation.CommonLog;
import com.unis.common.pojo.CommonResult;
import com.unis.common.pojo.CommonValidList;
import com.unis.policy.info.modular.alPolicyFileReport.entity.AlPolicyFileReport;
import com.unis.policy.info.modular.alPolicyFileReport.param.AlPolicyFileReportAddParam;
import com.unis.policy.info.modular.alPolicyFileReport.param.AlPolicyFileReportEditParam;
import com.unis.policy.info.modular.alPolicyFileReport.param.AlPolicyFileReportIdParam;
import com.unis.policy.info.modular.alPolicyFileReport.param.AlPolicyFileReportPageParam;
import com.unis.policy.info.modular.alPolicyFileReport.service.AlPolicyFileReportService;

import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;
import java.util.Map;

/**
 * 行政法规管理-政策规范性文件申报控制器
 *
 * @author TS
 * @date  2024/04/18 15:02
 */
@Api(tags = "行政法规管理-政策规范性文件申报控制器")
@ApiSupport(author = "UNIS_TEAM", order = 1)
@RestController
@Validated
public class AlPolicyFileReportController {

    @Resource
    private AlPolicyFileReportService alPolicyFileReportService;

    /**
     * 获取行政法规管理-政策规范性文件申报分页
     *
     * @author TS
     * @date  2024/04/18 15:02
     */
//    @ApiOperationSupport(order = 1)
//    @ApiOperation("获取行政法规管理-政策规范性文件申报分页")
//    @SaCheckPermission("/policy.info/alPolicyFileReport/page")
//    @GetMapping("/policy.info/alPolicyFileReport/page")
//    public CommonResult<Page<AlPolicyFileReport>> page(AlPolicyFileReportPageParam alPolicyFileReportPageParam) {
//        return CommonResult.data(alPolicyFileReportService.page(alPolicyFileReportPageParam));
//    }
    /**
     * 获取行政法规管理-政策规范性文件申报自定义分页
     *
     * @author TS
     * @date  2024/04/18 15:02
     */
    @ApiOperationSupport(order = 1)
    @ApiOperation("获取行政法规管理-政策规范性文件申报自定义分页")
//    @SaCheckPermission("/policy.info/alPolicyFileReport/findPage")
    @GetMapping("/policy.info/alPolicyFileReport/findPage")
    public CommonResult<IPage<Map<String,Object>>> findPage(AlPolicyFileReportPageParam alPolicyFileReportPageParam) {
        return CommonResult.data(alPolicyFileReportService.findPage(alPolicyFileReportPageParam));
    }

    /**
     * 添加行政法规管理-政策规范性文件申报
     *
     * @author TS
     * @date  2024/04/18 15:02
     */
    @ApiOperationSupport(order = 2)
    @ApiOperation("添加行政法规管理-政策规范性文件申报")
    @CommonLog("添加行政法规管理-政策规范性文件申报")
//    @SaCheckPermission("/policy.info/alPolicyFileReport/add")
    @PostMapping("/policy.info/alPolicyFileReport/add")
    public CommonResult<String> add(@RequestBody @Valid AlPolicyFileReportAddParam alPolicyFileReportAddParam) {
        alPolicyFileReportService.add(alPolicyFileReportAddParam);
        return CommonResult.ok();
    }

    /**
     * 编辑行政法规管理-政策规范性文件申报
     *
     * @author TS
     * @date  2024/04/18 15:02
     */
    @ApiOperationSupport(order = 3)
    @ApiOperation("编辑行政法规管理-政策规范性文件申报")
    @CommonLog("编辑行政法规管理-政策规范性文件申报")
//    @SaCheckPermission("/policy.info/alPolicyFileReport/edit")
    @PostMapping("/policy.info/alPolicyFileReport/edit")
    public CommonResult<String> edit(@RequestBody @Valid AlPolicyFileReportEditParam alPolicyFileReportEditParam) {
        alPolicyFileReportService.edit(alPolicyFileReportEditParam);
        return CommonResult.ok();
    }

    /**
     * 删除行政法规管理-政策规范性文件申报
     *
     * @author TS
     * @date  2024/04/18 15:02
     */
    @ApiOperationSupport(order = 4)
    @ApiOperation("删除行政法规管理-政策规范性文件申报")
    @CommonLog("删除行政法规管理-政策规范性文件申报")
//    @SaCheckPermission("/policy.info/alPolicyFileReport/delete")
    @PostMapping("/policy.info/alPolicyFileReport/delete")
    public CommonResult<String> delete(@RequestBody @Valid AlPolicyFileReportIdParam alPolicyFileReportIdParam) {
        alPolicyFileReportService.delete(alPolicyFileReportIdParam);
        return CommonResult.ok();
    }

    /**
     * 获取行政法规管理-政策规范性文件申报详情
     *
     * @author TS
     * @date  2024/04/18 15:02
     */
    @ApiOperationSupport(order = 5)
    @ApiOperation("获取行政法规管理-政策规范性文件申报详情")
//    @SaCheckPermission("/policy.info/alPolicyFileReport/detail")
    @GetMapping("/policy.info/alPolicyFileReport/detail")
    public CommonResult<AlPolicyFileReport> detail(@Valid AlPolicyFileReportIdParam alPolicyFileReportIdParam) {
        return CommonResult.data(alPolicyFileReportService.detail(alPolicyFileReportIdParam));
    }

    /**
     * 发起行政法规管理-政策规范性文件申报流程
     *
     * @author TS
     * @date  2024/04/18 15:02
     */
    @ApiOperationSupport(order = 6)
    @ApiOperation("发起行政法规管理-政策规范性文件申报流程")
//    @SaCheckPermission("/policy.info/alPolicyFileReport/startFlow")
    @GetMapping("/policy.info/alPolicyFileReport/startFlow")
    public CommonResult<String> startFlow(@Valid AlPolicyFileReportIdParam alPolicyFileReportIdParam) {
        return CommonResult.data(alPolicyFileReportService.startFlow(alPolicyFileReportIdParam));
    }
    /**
     * 获取行政法规管理-政策规范性文件申报部门
     *
     * @author TS
     * @date  2024/04/18 15:02
     */
    @ApiOperationSupport(order = 7)
    @ApiOperation("获取行政法规管理-政策规范性文件申报部门")
//    @SaCheckPermission("/policy.info/alPolicyFileReport/getReportDepts")
    @GetMapping("/policy.info/alPolicyFileReport/getReportDepts")
    public CommonResult<List<SysOrg>> getReportDepts() {
        return CommonResult.data(alPolicyFileReportService.getReportDepts());
    }
    /**
     * 获取行政法规管理-政策规范性文件申报下拉列表数据
     *
     * @author TS
     * @date  2024/04/18 15:02
     */
    @ApiOperationSupport(order = 8)
    @ApiOperation("获获取行政法规管理-政策规范性文件申报下拉列表数据")
//    @SaCheckPermission("/policy.info/alPolicyFileReport/getReportsByCurUser")
    @GetMapping("/policy.info/alPolicyFileReport/getReportsByCurUser")
    public CommonResult<List<Map<String,Object>>> getReportsByCurUser() {
        return CommonResult.data(alPolicyFileReportService.getReportsByCurUser());
    }
}
