package com.bizzan.bitrade.controller.finance;

import com.bizzan.bitrade.annotation.AccessLog;
import com.bizzan.bitrade.constant.AdminModule;
import com.bizzan.bitrade.constant.TransactionTypeEnum;
import com.bizzan.bitrade.service.LocaleMessageSourceService;
import com.bizzan.bitrade.util.MessageResult;
import com.fasterxml.jackson.annotation.JsonFormat;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

@RestController
@RequestMapping("finance/statistics")
public class FinanceStatisticsController {

    private static final Logger logger = LoggerFactory.getLogger(FinanceStatisticsController.class);

    @Autowired
    private LocaleMessageSourceService messageSource;

    @PostMapping("turnover-all")
    @AccessLog(module = AdminModule.FINANCE, operation = "法币/币币  总成交量/总成交额")
    public MessageResult getResult(
            String[] types,
            @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") Date startDate,
            @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") Date endDate,
            String unit) {
        return MessageResult.getSuccessInstance(messageSource.getMessage("SUCCESS"), Collections.emptyList());
    }

    @PostMapping("fee")
    @AccessLog(module = AdminModule.FINANCE, operation = "手续费统计 总计[\"OTC_NUM\",\"WITHDRAW\",\"EXCHANGE\"]")
    public MessageResult getFee(TransactionTypeEnum type
            , @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") Date startDate
            , @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") Date endDate
            , String unit) {
        return MessageResult.getSuccessInstance(messageSource.getMessage("SUCCESS"), Collections.emptyList());
    }

    @PostMapping("recharge-or-withdraw-amount")
    @AccessLog(module = AdminModule.FINANCE, operation = "充币/提币总量统计")
    public MessageResult recharge(TransactionTypeEnum type
            , @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") Date startDate
            , @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") Date endDate
    ) {
        return MessageResult.getSuccessInstance(messageSource.getMessage("SUCCESS"), Collections.emptyList());
    }
}
