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

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.app.service.IGameService;
import org.jeecg.modules.app.vo.game.*;
import org.jeecg.modules.system.app.entity.AppGame;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * app赛事
 */
@Slf4j
@Tag(name = "App赛事相关接口")
@RestController
@RequestMapping("/app/game")
public class GameController {

    @Autowired
    private IGameService iGameService;


    @GetMapping("/findByList")
    @Operation(summary = "赛事列表查询")
    public Result<IPage<FindPagResponse>> findConcerts(@Valid FindPageGameVO findPageGame){

        return iGameService.findConcerts(findPageGame);
    }


    @GetMapping("/findById")
    @Operation(summary = "赛事详情查询")
    public Result<FindByIdResponse> findById(@RequestParam("id") String id,@RequestParam("longitude") String longitude,@RequestParam("latitude") String latitude){
        return iGameService.findById(id,longitude,latitude);
    }

    @GetMapping("/findByGameId")
    @Operation(summary = "根据赛事id查询比赛详情")
    public Result<FindByGameIdPriceVo> findByGameId(@RequestParam("id") String id){
        return iGameService.findByGameId(id);
    }

    @GetMapping("/findScoreByGameId")
    @Operation(summary = "查询赛事成绩")
    public Result<AppGame> findScoreByGameId(@RequestParam("orderId") String orderId){
        return iGameService.findScoreByGameId(orderId);
    }

    @GetMapping("/findScheduleByOrderId")
    @Operation(summary = "查询赛事安排")
    public Result<List<GameScheduleVO>> findScheduleByOrderId(@RequestParam("orderId") String orderId){
        return iGameService.findScheduleByOrderId(orderId);
    }

}
