package cn.com.taiji.video.cotroller;


import cn.com.taiji.video.model.VideoAnalysisLineDTO;
import cn.com.taiji.video.model.VideoAnalysisPieDTO;
import cn.com.taiji.video.model.VideoDTO;
import cn.com.taiji.video.model.VideoRecord;
import cn.com.taiji.video.service.IVideoUrlService;
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.RestController;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;


@RestController
@RequestMapping("video")
public class VideoUrlController {

    @Autowired
    private IVideoUrlService urlService;

    @GetMapping("url")
    public void queryUrl(String number) {
        urlService.httpsPost(number);
    }

    @GetMapping("record")
    public List<VideoDTO> queryVideoList() {
        return urlService.queryVideoList();
    }

    @GetMapping("record/list")
    public List<VideoRecord> queryVideoRecord() {
        return urlService.queryVideoRecord();
    }

    @GetMapping("analysis/test")
    public void queryTestPie(Integer type, String startTime, String endTime) {
        LocalDate startDate = LocalDate.parse(startTime);
        LocalDate endDate = LocalDate.parse(endTime);
        urlService.queryTestPie(type, startDate, endDate);
    }

    @GetMapping("analysis/all")
    public Integer queryPieRecordAll() {
        return urlService.queryPieRecordAll();
    }

    @GetMapping("analysis/pie")
    public VideoAnalysisPieDTO queryPieRecord(Integer type) {
        return urlService.queryPieRecord(type);
    }

    @GetMapping("analysis/line")
    public List<VideoAnalysisLineDTO> queryLineRecord(Integer type) {
        return urlService.queryLineRecord(type);
    }

}
