package com.crm.manager.service.ib;

import com.crm.rely.backend.core.constant.FeignClientAnnotation;
import com.crm.rely.backend.core.constant.IbReportAnnotation;
import com.crm.rely.backend.core.dto.base.BaseReportResultDto;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.ib.trade.*;
import com.crm.rely.backend.core.entity.base.BaseIbReportListEntity;
import com.crm.rely.backend.core.entity.custom.info.InfoEntity;
import com.crm.rely.backend.core.entity.ib.trade.*;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * Created by max on 2020/7/14.
 */
@FeignClient(name = "IB-SERVICE", path = "/manage/service/trade")
public interface TradeFeignService {


    /**
     * 交易历史
     *
     * @param entity
     * @throws Exception
     */
    @PostMapping("/history")
    BaseReportResultDto<List<TradeHistoryDto>, TradeHistorySumDto> tradeHistory(TradeHistoryListEntity entity) throws Exception;

    @PostMapping("/history/export")
    BaseResultDto<List<TradeHistoryDto>> tradeHistoryExport(TradeHistoryListEntity entity) throws Exception;

    /**
     * 持仓查询
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/position")
    BaseReportResultDto<List<TradePositionDto>, TradePositionSumDto> tradePosition(TradePositionListEntity entity) throws Exception;

    @PostMapping("/position/export")
    BaseResultDto<List<TradePositionDto>> tradePositionExport(TradePositionListEntity entity) throws Exception;

    /**
     * 挂单查询
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/pending")
    BaseReportResultDto<List<TradePendingDto>, TradePendingSumDto> tradePending(TradePendingListEntity entity) throws Exception;

    @PostMapping("/pending/export")
    BaseResultDto<List<TradePendingDto>> tradePendingExport(TradePendingListEntity entity) throws Exception;

    /**
     * 挂单历史
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/pending/history")
    BaseReportResultDto<List<TradePendingHistoryDto>, TradePendingHistorySumDto> tradePendingHistory(TradePendingHistoryListEntity entity) throws Exception;

    @PostMapping("/pending/history/export")
    BaseResultDto<List<TradePendingHistoryDto>> tradePendingHistoryExport(TradePendingHistoryListEntity entity) throws Exception;

    /**
     * 品种报表
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/symbols")
    BaseReportResultDto<List<TradeSymbolDto>, TradeSymbolSumDto> tradeSymbol(TradeSymbolListEntity entity) throws Exception;

    @PostMapping("/symbols/export")
    BaseResultDto<List<TradeSymbolDto>> tradeSymbolExport(TradeSymbolListEntity entity) throws Exception;

    /**
     * 佣金报表
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/agent/commission")
    BaseReportResultDto<List<TradeCommissionDto>, TradeCommissionSumDto> tradeCommission(BaseIbReportListEntity entity) throws Exception;

    @PostMapping("/agent/commission/export")
    BaseResultDto<List<TradeCommissionDto>> tradeCommissionExport(BaseIbReportListEntity entity) throws Exception;

    /**
     * 交易账户
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/account")
    BaseReportResultDto<List<TradeAccountDto>, TradeAccountSumDto> tradeAccount(BaseIbReportListEntity entity) throws Exception;

    @PostMapping("/account/export")
    BaseResultDto<List<TradeAccountDto>> tradeAccountExport(BaseIbReportListEntity entity) throws Exception;

    /**
     * 存取款
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/dw")
    BaseReportResultDto<List<TradeDwDto>, TradeDwSumDto> tradeDw(BaseIbReportListEntity entity) throws Exception;

    @PostMapping("/dw/export")
    BaseResultDto<List<TradeDwDto>> tradeDwExport(BaseIbReportListEntity entity) throws Exception;

    /**
     * 佣金报表
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/agent/commission/conclude")
    BaseReportResultDto<List<TradeCommissionDto>, TradeCommissionSumDto> tradeCommissionConclude(BaseIbReportListEntity entity) throws Exception;

    /**
     * 佣金综合
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/agent/commission/conclude/export")
    BaseResultDto<List<TradeCommissionDto>> tradeCommissionConcludeExport(BaseIbReportListEntity entity) throws Exception;

    /**
     * 交易量佣金
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/volume")
    BaseReportResultDto<List<TradeVolumeDto>, TradeVolumeSumDto> tradeVolume(BaseIbReportListEntity entity) throws Exception;

    /**
     * 交易量佣金报表导出
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/volume/export")
    BaseResultDto<List<TradeVolumeDto>> tradeVolumeExport(BaseIbReportListEntity entity) throws Exception;

    /**
     * 销售佣金报表
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/sales/commission")
    BaseReportResultDto<List<TradeSalesCommissionDto>, TradeSalesCommissionSumDto> tradeSalesCommission(BaseIbReportListEntity entity) throws Exception;


    /**
     * 销售佣金报表
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/sales/commission/export")
    BaseResultDto<List<TradeSalesCommissionDto>> tradeSalesCommissionExport(BaseIbReportListEntity entity) throws Exception;

    /**
     * 盈亏排行
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/profit/ranking")
    BaseReportResultDto<List<TradeProfitRankingDto>, TradeProfitRankingSumDto> tradeProfitRanking(TradeProfitRankingEntity entity) throws Exception;

    /**
     * 盈亏报表导出
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/profit/ranking/export")
    BaseResultDto<List<TradeProfitRankingDto>> tradeProfitRankingExport(TradeProfitRankingEntity entity) throws Exception;

    /**
     * 销售股票佣金报表
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/sales/stock/commission")
    BaseReportResultDto<List<TradeSalesStockCommissionDto>, TradeSalesStockCommissionSumDto> tradeSalesStockCommission(TradeSalesStockCommissionEntity entity) throws Exception;

    /**
     * 销售股票佣金报表导出
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/sales/stock/commission/export")
    BaseResultDto<List<TradeSalesStockCommissionDto>> tradeSalesStockCommissionExport(TradeSalesStockCommissionEntity entity) throws Exception;

    /**
     * 对冲报表
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/hedging")
    BaseReportResultDto<List<TradeHedgingDto>, Object> tradeHedging(@RequestBody BaseIbReportListEntity entity) throws Exception;

    @PostMapping("/pm/dw")
    BaseReportResultDto<List<TradePmDwDto>, TradePmDwSumDto> tradePmDw(@RequestBody BaseIbReportListEntity entity) throws Exception;

    @PostMapping("/pm/dw/export")
    BaseResultDto<List<TradePmDwDto>> tradePmDwExport(@RequestBody BaseIbReportListEntity entity) throws Exception;

    @PostMapping("/account/summary")
    BaseReportResultDto<List<AccountDailySummaryDto>, AccountDailySummarySumDto> accountSummary(@RequestBody BaseIbReportListEntity entity) throws Exception;

}
