package com.ym.mec.student.controller;

import com.ym.mec.biz.dal.dto.ConditionDto;
import com.ym.mec.biz.dal.dto.VipGroupApplyDto;
import com.ym.mec.biz.dal.page.StudentVipGroupQueryInfo;
import com.ym.mec.biz.service.SubjectService;
import com.ym.mec.biz.service.VipGroupService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.page.QueryInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author Joburgess
 * @Date 2019/9/23
 */

@Api(tags = "vip课-学生端")
@RequestMapping("studentVipGroup")
@RestController
public class StudentVipGroupController extends BaseController {

    @Autowired
    private VipGroupService vipGroupService;
    @Autowired
    private SubjectService subjectService;

    @ApiOperation("获取vip课列表筛选条件")
    @GetMapping(value = "/findQueryCondition")
    public Object findQueryCondition(){
        Map<String,Object> result=new HashMap<>();
        result.put("subjects",subjectService.findAll(null));
        List<ConditionDto> conditionDtos=new ArrayList<>();
        conditionDtos.add(new ConditionDto(0L,"线下"));
        conditionDtos.add(new ConditionDto(1L,"线上"));
        result.put("pageInfo",conditionDtos);
        return succeed(result);
    }

    @ApiOperation("获取vip课列表")
    @GetMapping(value = "/queryVipGroups")
    public Object queryVipGroups(StudentVipGroupQueryInfo queryInfo){
        Map<String,Object> result=new HashMap<>();
        result.put("recommendVipGroups",new ArrayList<>());
        result.put("pageInfo",vipGroupService.findStudentVipGroupList(queryInfo));
        return succeed(result);
    }

    @ApiOperation("获取学生端vip课显示详情")
    @GetMapping(value = "/getVipGroupShowDetail/{vipGroupId}")
    public Object getVipGroupShowDetail(@PathVariable("vipGroupId") Long vipGroupId){
        return succeed(vipGroupService.getVipGroupShowDetail(vipGroupId));
    }

}
