package com.izouma.nineth.web;

import com.izouma.nineth.service.StatisticService;
import lombok.AllArgsConstructor;
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.util.Map;

@RestController
@RequestMapping("/statistic")
@AllArgsConstructor
public class StatisticController {
    private StatisticService statisticService;

    @GetMapping("/total")
    public Map<String, Object> total() {
        return statisticService.total();
    }

    @GetMapping("/userTrend")
    public Map<String, Long> userTrend(int day) {
        return statisticService.userTrend(day);
    }

    @GetMapping("/orderNumTrend")
    public Map<String, Map<String, Long>> orderNumTrend(int day) {
        return statisticService.orderNumTrend(day);
    }

    @GetMapping("/orderPriceTrend")
    public Map<String, Map<String, BigDecimal>> orderPriceTrend(int day) {
        return statisticService.orderPriceTrend(day);
    }
}
