package com.muchinfo.mtp3century.controller;

import com.muchinfo.mtp3century.service.ITradingMarketSetService;
import com.muchinfo.mtp3century.utils.AjaxResult;
import com.muchinfo.mtp3common.vo.PageResult;
import com.muchinfo.mtp3pojos.entity.*;
import com.muchinfo.mtp3pojos.vo.tradingmarket.QuoteSourceGroupRunStepParam;
import com.muchinfo.mtp3pojos.vo.tradingmarket.TradingGroupSetResult;
import com.muchinfo.mtp3pojos.vo.tradingmarket.TradingMarketSetGroupConfigParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/marketset")
@Api(value = "交易市场API", description = "交易市场管理-->行情设置")
public class TradingMarketSetController {

    @Resource
    private ITradingMarketSetService iTradingMarketSetService;

    @RequestMapping(method = RequestMethod.GET, value = "/querysummertimegroup")
    @ApiOperation("交易市场管理--> 行情设置 --> 夏令时分组管理 --> 获取列表")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public PageResult<Summertimegroup> querysummertimegroup(Integer pageNum, Integer pageSize, HttpServletRequest request) {
        return iTradingMarketSetService.querysummertimegroup(pageNum, pageSize, request);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/summertimegroupAdd")
    @ApiOperation("交易市场管理--> 行情设置 --> 夏令时分组管理 --> 新增、修改")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult summertimegroupAdd(@RequestBody Summertimegroup param, HttpServletRequest request) {
        return iTradingMarketSetService.summertimegroupAdd(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/deleteGroup")
    @ApiOperation("交易市场管理--> 行情设置 --> 夏令时分组管理 --> 删除")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult deleteGroup(Long autoId, HttpServletRequest request) {
        return iTradingMarketSetService.deleteGroup(autoId, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/queryConfig")
    @ApiOperation("交易市场管理--> 行情设置 --> 夏令时分组管理 -->分组时间配置 --> 获取列表")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public PageResult<Summertimegroupconfig> queryConfig(TradingMarketSetGroupConfigParam param, HttpServletRequest request) {
        return iTradingMarketSetService.queryConfig(param, request);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/summertimegroupConfigAdd")
    @ApiOperation("交易市场管理--> 行情设置 --> 夏令时分组管理 --> 分组时间配置--> 新增、修改")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult summertimegroupConfigAdd(@RequestBody Summertimegroupconfig param, HttpServletRequest request) {
        return iTradingMarketSetService.summertimegroupConfigAdd(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/deleteGroupConfig")
    @ApiOperation("交易市场管理--> 行情设置 --> 夏令时分组管理 -->分组时间配置-->  删除")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult deleteGroupConfig(Long groupId, Integer summeryear, HttpServletRequest request) {
        return iTradingMarketSetService.deleteGroupConfig(groupId, summeryear, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/quoteSourceGroup")
    @ApiOperation("交易市场管理--> 行情设置 --> 行情源分组管理 --> 获取列表")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public PageResult<Quotesourcegroup> quoteSourceGroup(Integer pageNum, Integer pageSize, HttpServletRequest request) {
        return iTradingMarketSetService.quoteSourceGroup(pageNum, pageSize, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/queryAllSummerTimeGroup")
    @ApiOperation("交易市场管理--> 行情设置 --> 行情源分组管理 -->新增初始化")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<Summertimegroup> queryAllSummerTimeGroup(HttpServletRequest request) {
        return iTradingMarketSetService.queryAllSummerTimeGroup(request);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/quoteSourceGroupAdd")
    @ApiOperation("交易市场管理--> 行情设置 --> 行情源分组管理 --> 新增、修改")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult quoteSourceGroupAdd(@RequestBody Quotesourcegroup param, HttpServletRequest request) {
        return iTradingMarketSetService.quoteSourceGroupAdd(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/quoteSourceGroupDelete")
    @ApiOperation("交易市场管理--> 行情设置 --> 行情源分组管理-->  删除")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult quoteSourceGroupDelete(Long autoId, HttpServletRequest request) {
        return iTradingMarketSetService.quoteSourceGroupDelete(autoId, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/externalexchange")
    @ApiOperation("交易市场管理--> 行情设置 --> 外部平台管理 -->获取列表")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public PageResult<Externalexchange> externalexchange(Integer pageNum, Integer pageSize, HttpServletRequest request) {
        return iTradingMarketSetService.externalexchange(pageNum, pageSize, request);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/externalexchangeadd")
    @ApiOperation("交易市场管理--> 行情设置 --> 外部平台管理 --> 新增、修改")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult externalexchangeadd(@RequestBody Externalexchange param, HttpServletRequest request) {
        return iTradingMarketSetService.externalexchangeadd(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/externalexchangedel")
    @ApiOperation("交易市场管理--> 行情设置 --> 外部平台管理-->  删除")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult externalexchangedel(Long autoId, HttpServletRequest request) {
        return iTradingMarketSetService.externalexchangedel(autoId, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/quoteSourceGroupAll")
    @ApiOperation("交易市场管理--> 行情设置 --> 分组时段管理 --> 复制下拉列表初始化")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<Quotesourcegroup> quoteSourceGroupAll(HttpServletRequest request) {
        return iTradingMarketSetService.quoteSourceGroupAll(request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/quoteSourceGroupRunStep")
    @ApiOperation("交易市场管理--> 行情设置 --> 分组时段管理 -->获取列表")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public PageResult<TradingGroupSetResult> quoteSourceGroupRunStep(Integer pageNum, Integer pageSize, HttpServletRequest request) {
        return iTradingMarketSetService.quoteSourceGroupRunStep(pageNum, pageSize, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/quotecopy")
    @ApiOperation("交易市场管理--> 行情设置 --> 分组时段管理 --> 复制")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult quotecopy(HttpServletRequest request, Long source, Long target) {
        return iTradingMarketSetService.quotecopy(request, source, target);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/quoteSourceGroupRunStepDetail")
    @ApiOperation("交易市场管理--> 行情设置 --> 分组时段管理-->  详情")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<Quotesourcegroup> quoteSourceGroupRunStepDetail(Long autoId, HttpServletRequest request) {
        return iTradingMarketSetService.quoteSourceGroupRunStepDetail(autoId, request);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/editSave")
    @ApiOperation("交易市场管理--> 行情设置 --> 分组时段管理 --> 修改保存")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult editSave(HttpServletRequest request,@RequestBody QuoteSourceGroupRunStepParam param) {
        return iTradingMarketSetService.editSave(request, param);
    }
}
