import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Query,
} from '@nestjs/common';

import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
import { TokenData } from 'src/common/decorator/token-data.decorator';

import { CreateLiveTeachingDto } from '../dto/live-create.dto';
import { UpdateLiveTeachingDto } from '../dto/live-update.dto';
import { LiveClassService } from '../service/live-class.service';
import { PaginationDTO } from '../../online-course/common/pagination.dto';
import { CreateCourseclassifyDto } from 'src/online-course/dto/course-manage/course-classify.dto';
import { updateCourseclassifyDto } from 'src/online-course/dto/course-manage/update-course-classify.dto';
import { DeleteDto } from 'src/online-course/common/delete-dto';
import { get } from 'http';
import { NoAuthToken } from 'src/common/decorator/no-token.decorator';
import {
  SearchLsitDto,
  SearchNoClassLsitDto,
} from 'src/online-course/dto/course-manage/get-course-list-dto';
import { LiveAnsweringDto } from '../dto/live-question-answer.dto';
@ApiTags('在线教学-学员端')
@ApiBearerAuth()
// @NoAuthToken()
@Controller('live-class')
export class LiveClassController {
  constructor(private readonly LiveClassService: LiveClassService) {}
  // 获取需要参加的直播列表
  @Get()
  @ApiOperation({ summary: '获取我的直播列表' })
  findLiveForMy(@Query() pageInfo: PaginationDTO, @TokenData() tokenInfo: any) {
    return this.LiveClassService.findMyLiveList(pageInfo, tokenInfo);
  }
  @Get('search')
  @ApiOperation({ summary: '搜索我的直播列表' })
  searchMyLiveList(
    @Query() searchInfo: SearchNoClassLsitDto,
    @TokenData() tokenInfo: any,
  ) {
    return this.LiveClassService.searchMyLiveList(searchInfo, tokenInfo);
  }
  @Get('question/:liveId')
  @ApiOperation({ summary: '获取所有试题列表' })
  getLiveQuestionList(@Param('liveId') liveId: number) {
    return this.LiveClassService.getLiveQuestionList(liveId);
  }
  @Get('liveStudent/:id')
  @ApiOperation({ summary: '参加直播时获取详情' })
  getStudentList(@Param('id') id: number, @TokenData() tokenInfo: any) {
    return this.LiveClassService.getStudentList(id, tokenInfo);
  }
  @Get(':id')
  @ApiOperation({ summary: '参加直播时获取详情' })
  getLiveInfo(@Param('id') id: number, @TokenData() tokenInfo: any) {
    return this.LiveClassService.getLiveInfo(id, tokenInfo);
  }

  @Post('answering')
  @ApiOperation({ summary: '回答直播的练习题' })
  answeringQuestions(
    @Body() answerData: LiveAnsweringDto,
    @TokenData() tokenData,
  ) {
    return this.LiveClassService.answeringQuestions(answerData, tokenData);
  }
}
