package com.crm.manager.controller;

import com.crm.manager.service.risk.RiskSymbolLeverageFeignService;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
import com.crm.rely.backend.core.dto.risk.symbol.leverage.RiskSymbolLeverageDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.risk.symbol.leverage.RiskSymbolLeverageAddEntity;
import com.crm.rely.backend.core.entity.risk.symbol.leverage.RiskSymbolLeverageDeleteEntity;
import com.crm.rely.backend.core.entity.risk.symbol.leverage.RiskSymbolLeverageSearchEntity;
import com.crm.rely.backend.core.entity.risk.symbol.leverage.RiskSymbolLeverageUpdateEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 货币风控定时杠杠设置
 *
 * @author houn
 */
@RestController
@RequestMapping("/risk/symbol/leverage")
public class RiskSymbolLeverageController {

    @Autowired
    private RiskSymbolLeverageFeignService feignService;

    /**
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/add")
    public BaseResultDto add(@RequestBody @Validated RiskSymbolLeverageAddEntity entity) throws Exception {

        return feignService.add(entity);
    }

    @PostMapping("/update")
    public BaseResultDto update(@RequestBody @Validated RiskSymbolLeverageUpdateEntity entity) throws Exception {

        return feignService.update(entity);
    }

    @PostMapping("/delete")
    public BaseResultDto delete(@RequestBody @Validated RiskSymbolLeverageDeleteEntity entity) throws Exception {

        return feignService.delete(entity);
    }

    @PostMapping("/search/list")
    public ResultWithPagerDto<RiskSymbolLeverageDto> pageList(@RequestBody @Validated RiskSymbolLeverageSearchEntity entity) throws Exception {

        return feignService.pageList(entity);
    }

    @PostMapping("/search/single")
    public BaseResultDto<RiskSymbolLeverageDto> single(@RequestBody @Validated SingleLongEntity entity) throws Exception {

        return feignService.single(entity);
    }
}
