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.ParentAgentActivityQueryReq;
import com.seer.teach.mp.admin.controller.resp.AdminParentAgentActivityResp;
import com.seer.teach.mp.admin.service.AdminParentAgentActivityService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 家长参与代理商活动控制器 - 管理端
 */
@Tag(name = "管理端 - 家长参与代理商活动管理")
@AllArgsConstructor
@RestController
@RequestMapping("/mp/parent/agent/activity")
public class AdminParentAgentActivityController {

    private final AdminParentAgentActivityService adminParentAgentActivityService;

    @PostMapping("/page")
    @SaCheckPermission("admin:parent:agent:activity:page")
    @Operation(summary = "分页查询家长参与代理商活动记录")
    @LogPrint
    public ResultBean<PageListBean<AdminParentAgentActivityResp>> pageList(
            @RequestBody ParentAgentActivityQueryReq queryReq) {
        return ResultBean.success(adminParentAgentActivityService.pageList(queryReq));
    }

    @GetMapping("/{id}")
    @SaCheckPermission("admin:parent:agent:activity:detail")
    @Operation(summary = "获取家长参与代理商活动记录详情")
    @LogPrint
    public ResultBean<AdminParentAgentActivityResp> detail(@PathVariable Integer id) {
        return ResultBean.success(adminParentAgentActivityService.getDetail(id));
    }

    @PostMapping("delete")
    @SaCheckPermission("admin:parent:agent:activity:delete")
    @Operation(summary = "删除家长参与代理商活动记录")
    @LogPrint
    public ResultBean<Boolean> delete(@RequestBody List<Integer> ids) {
        return ResultBean.success(adminParentAgentActivityService.delete(ids));
    }
}