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

import cn.dev33.satoken.annotation.SaCheckPermission;
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.AppMpAgentResp;
import com.seer.teach.mp.app.service.IAppActivityService;
import com.seer.teach.mp.app.service.IAppAgentService;
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.RestController;

/**
 * <p>
 * 代理商App控制器
 * </p>
 *
 * @author Lingma
 * @since 2025-12-29
 */
@Tag(name = "APP - 代理商管理接口")
@RestController
@RequestMapping("/app/agent")
@LogPrint
@EncryptionAnnotation
@DecryptionAnnotation
@RequiredArgsConstructor
public class AppAgentController {

    private final IAppActivityService agentActivityService;
    private final IAppAgentService appAgentService;

    @Operation(summary = "获取代理商详情")
    @GetMapping("/detail")
    @SaCheckPermission("mp:app:agent:detail")
    public ResultBean<AppMpAgentResp> getAgent() {
        Integer userId = StpUtil.getLoginIdAsInt();
        return ResultBean.success(appAgentService.getAgentRespByUserId(userId));
    }
}