package com.seer.teach.mp.admin.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.seer.teach.common.PageListBean;
import com.seer.teach.common.ResultBean;
import com.seer.teach.common.annotation.LogPrint;
import com.seer.teach.mp.admin.controller.req.ActivityInfoCollectionQueryReq;
import com.seer.teach.mp.admin.controller.resp.AdminActivityInfoCollectionResp;
import com.seer.teach.mp.admin.service.AdminActivityInfoCollectionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "管理端 - 活动信息收集管理")
@LogPrint
@RequiredArgsConstructor
@RestController
@RequestMapping("/mp/activity/info/collection")
public class AdminActivityInfoCollectionController {

    private final AdminActivityInfoCollectionService adminActivityInfoCollectionService;

    @PostMapping("/page")
    @SaCheckPermission("admin:activity:info:collection:page")
    @Operation(summary = "分页查询活动信息收集记录")
    public ResultBean<PageListBean<AdminActivityInfoCollectionResp>> pageList(
            @RequestBody @Validated ActivityInfoCollectionQueryReq req) {
        PageListBean<AdminActivityInfoCollectionResp> result = adminActivityInfoCollectionService.pageList(req);
        return ResultBean.success(result);
    }


    @GetMapping("/{id}")
    @SaCheckPermission("admin:activity:info:collection:detail")
    @Operation(summary = "获取活动信息收集记录详情")
    public ResultBean<AdminActivityInfoCollectionResp> detail(@PathVariable Integer id) {
        return ResultBean.success(adminActivityInfoCollectionService.getDetail(id));
    }

    @PostMapping("delete")
    @SaCheckPermission("admin:activity:info:collection:delete")
    @Operation(summary = "删除活动信息收集记录")
    public ResultBean<Boolean> delete(@RequestBody List<Integer> ids) {
        return ResultBean.success(adminActivityInfoCollectionService.delete(ids));
    }
}
