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

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.stp.StpUtil;
import com.seer.teach.common.ResultBean;
import com.seer.teach.common.annotation.DecryptionAnnotation;
import com.seer.teach.common.annotation.EncryptionAnnotation;
import com.seer.teach.common.annotation.LogPrint;
import com.seer.teach.mp.app.controller.resp.AgentActivityParentInfoResp;
import com.seer.teach.mp.app.service.IAppAgentActivityParentInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 代理商活动参与家长信息App控制器
 * </p>
 *
 * @author Lingma
 * @since 2025-12-30
 */
@Tag(name = "APP - 参与代理商活动家长信息")
@RestController
@RequestMapping("/app/agent/activity/parent-info")
@LogPrint
@EncryptionAnnotation
@DecryptionAnnotation
@RequiredArgsConstructor
public class AppAgentActivityParentInfoController {

    private final IAppAgentActivityParentInfoService agentActivityParentInfoService;

    @Operation(summary = "获取参加指定活动的家长列表")
    @GetMapping("/getActivityParents")
    @SaCheckLogin
    public ResultBean<List<AgentActivityParentInfoResp>> getActivityParents(
            @RequestParam("activityId") Integer activityId,
            @RequestParam("agentId") Integer agentId) {
        Integer userId = StpUtil.getLoginIdAsInt();
        return ResultBean.success(agentActivityParentInfoService.getParentsByActivityAndAgent(activityId, agentId,userId));
    }
}