package org.jeecg.modules.app.controller.coach;


import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.app.service.ICoachService;
import org.jeecg.modules.app.vo.coach.AppCoachDetailsRequestVO;
import org.jeecg.modules.app.vo.coach.AppCoachDetailsVO;
import org.jeecg.modules.app.vo.coach.AppCoachVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * App教练
 */
@Slf4j
@Tag(name = "App教练")
@RestController
@RequestMapping("/app/coachC")
public class CoachController {

    @Autowired
    ICoachService iCoachService;


    /**
     * @Description 查询全部教练
     * @Date 19:41 2025/7/11
     **/
    @GetMapping("/findCoachList")
    @Operation(summary = "查询全部教练")
    public Result<List<AppCoachVO>> findCoachList(){
        return iCoachService.findCoachList();
    }

    /**
     * @Description 查询教练详情
     * @Date 19:41 2025/7/11
     **/
    @GetMapping("/findByCoachId")
    @Operation(summary = "查询教练详情")
    public Result<AppCoachDetailsVO> findByCoachId(AppCoachDetailsRequestVO appCoachDetailsRequestVO){
        if (StringUtils.isEmpty(appCoachDetailsRequestVO.getId())){
         return Result.error("查询失败,教练编号为空");
        }
        //获取登录用户信息
//        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//        return iCoachService.findByCoachId(appCoachDetailsRequestVO,sysUser.getId());
        return iCoachService.findByCoachId(appCoachDetailsRequestVO);
    }


}
