package com.crm.manager.controller;

import com.crm.manager.service.risk.RiskSymbolGtcPendingSymbolFeignService;
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.gtc.pending.symbol.RiskSymbolGtcPendingSymbolDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.risk.symbol.gtc.pending.symbol.RiskSymbolGtcPendingSymbolAddEntity;
import com.crm.rely.backend.core.entity.risk.symbol.gtc.pending.symbol.RiskSymbolGtcPendingSymbolDeleteEntity;
import com.crm.rely.backend.core.entity.risk.symbol.gtc.pending.symbol.RiskSymbolGtcPendingSymbolSearchEntity;
import com.crm.rely.backend.core.entity.risk.symbol.gtc.pending.symbol.RiskSymbolGtcPendingSymbolUpdateEntity;
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;

import java.util.List;

/**
 * @author houn
 */
@RestController
@RequestMapping("/risk/symbol/gtc/pending/symbol")
public class RiskSymbolGtcPendingSymbolController {

    @Autowired
    private RiskSymbolGtcPendingSymbolFeignService feignService;

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

        return feignService.add(entity);
    }

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

        return feignService.update(entity);
    }

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

        return feignService.delete(entity);
    }

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

        return feignService.pageList(entity);
    }

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

        return feignService.single(entity);
    }

    @PostMapping("/list")
    public BaseResultDto<List<RiskSymbolGtcPendingSymbolDto>> list() throws Exception {

        return feignService.list();
    }


}
