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

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.seer.teach.common.PageListBean;
import com.seer.teach.common.ResultBean;
import com.seer.teach.common.annotation.LogPrint;
import com.seer.teach.common.utils.PageConverterUtils;
import com.seer.teach.mp.admin.controller.req.ParentAgentActivityQueryReq;
import com.seer.teach.mp.admin.controller.resp.AdminParentAgentActivityResp;
import com.seer.teach.mp.admin.controller.resp.MpParentAgentActivityResp;
import com.seer.teach.mp.admin.service.AdminParentAgentActivityService;
import com.seer.teach.mp.entity.MpParentAgentActivityRelationEntity;
import com.seer.teach.mp.service.IMpParentAgentActivityRelationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 家长参与代理商活动控制器 - 管理端
 */
@Tag(name = "管理端 - 家长参与代理商活动管理")
@AllArgsConstructor
@RestController
@RequestMapping("/mp/admin/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));
    }
}