package com.tuoheng.admin.controller;

import com.tuoheng.admin.entity.request.index.GetAirportDetailDto;
import com.tuoheng.admin.entity.request.index.GetQuestionListDto;
import com.tuoheng.admin.service.IndexService;
import com.tuoheng.common.common.BaseQuery;
import com.tuoheng.common.utils.JsonResult;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author chenjiandong
 * @description: TODO
 * @date 2022/12/26 10:10
 */
@RestController
@RequestMapping("/index")
@ApiOperation(value = "首页")
@Slf4j
public class IndexGisController {

    @Autowired
    private IndexService indexService;

    /**
     * 获取任务列表
     * @param baseQuery
     * @return
     */
    @PostMapping("/getMissionList")
    public JsonResult getMissionList(@RequestBody BaseQuery baseQuery) {
        log.info("Index getMissionList start...");
        return JsonResult.success(indexService.getMissionList(baseQuery));
    }

    /**
     * 获取机场详细信息
     * @param airportId
     * @return
     */
    @GetMapping("/getAirportDetail/{airportId}")
    public JsonResult getAirportDetail(@PathVariable("airportId") Integer airportId) {
        log.info("Index getAirportDetail start... param:{}", airportId.toString());
        return indexService.getAirportDetail(airportId);
    }

    /**
     * 获取问题列表
     * @param getQuestionListDto
     * @return
     */
    @PostMapping("/getQuestionList")
    public JsonResult getQuestionList(@RequestBody @Validated GetQuestionListDto getQuestionListDto) {
        log.info("Index getQuestionList start... param:{}", getQuestionListDto.toString());
        return JsonResult.success(indexService.getQuestionList(getQuestionListDto));
    }

}
