package com.ym.mec.student.controller;

import com.ym.mec.biz.dal.entity.MusicGroupTrainPlanSaveDto;
import com.ym.mec.biz.dal.enums.YesOrNoEnum;
import com.ym.mec.biz.dal.page.MusicGroupPerformanceQueryInfo;
import com.ym.mec.biz.dal.page.MusicGroupTeachersQueryInfo;
import com.ym.mec.biz.dal.page.PhotoQueryInfo;
import com.ym.mec.biz.service.*;
import com.ym.mec.common.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("musicGroupDetail")
@Api(tags = "乐团档案服务")
@RestController
public class MusicGroupDetailController extends BaseController {

    @Autowired
    private MusicGroupNewsService musicGroupNewsService;
    @Autowired
    private MusicGroupPerformanceService musicGroupPerformanceService;
    @Autowired
    private PhotoAlbumService photoAlbumService;
    @Autowired
    private PhotoService photoService;
    @Autowired
    private MusicGroupTrainPlanService musicGroupTrainPlanService;
    @Autowired
    private MusicGroupService musicGroupService;
    @Autowired
    private ClassGroupService classGroupService;

    @ApiOperation("获取学员退团页面数据")
    @RequestMapping(value = "getQuitGroupDetail")
    public Object getQuitGroupDetail(String musicGroupId) {
        return succeed(musicGroupService.getQuitGroupDetail(musicGroupId));
    }

    @ApiOperation("获取乐团训练规划课时")
    @PostMapping(value = "queryPlanCourseNum")
    public Object queryPlanCourseNum(@RequestBody MusicGroupTrainPlanSaveDto musicGroupTrainPlanSaveDto) {
        musicGroupTrainPlanSaveDto.setStudentFlag(true);
        return succeed(musicGroupTrainPlanService.queryPlanCourseNum(musicGroupTrainPlanSaveDto));
    }

    @ApiOperation(value = "分页查询乐团资讯")
    @GetMapping("/queryNewsPage")
    public Object queryNewsPage(MusicGroupTeachersQueryInfo queryInfo) {
        return succeed(musicGroupNewsService.queryPage(queryInfo));
    }

    @ApiOperation("分页查询展演信息")
    @PostMapping(value = "queryPerformancePage")
    public Object queryPerformancePage(MusicGroupPerformanceQueryInfo queryInfo) {
        return succeed(musicGroupPerformanceService.queryPage(queryInfo));
    }

    @ApiOperation("分页查询相册")
    @PostMapping(value = "queryAlbumPage")
    public Object queryAlbumPage(PhotoQueryInfo queryInfo) {
        queryInfo.setClientShow(YesOrNoEnum.YES);
        return succeed(photoAlbumService.queryAlbumPage(queryInfo));
    }

    @ApiOperation("分页查询照片")
    @PostMapping(value = "queryPhotoPage")
    public Object queryPhotoPage(PhotoQueryInfo queryInfo) {
        queryInfo.setClientShow(YesOrNoEnum.YES);
        return succeed(photoService.queryPhotoPage(queryInfo));
    }

    @ApiOperation(value = "查询学员班级列表")
    @GetMapping("queryStudentAndTeacher")
    public Object queryStudentClassGroupsAndTeacher(String musicGroupId) {
        return succeed(classGroupService.queryStudentClassGroupsAndTeacher(musicGroupId));
    }
}
