package com.crm.manager.controller;

import com.crm.manager.service.risk.RiskSymbolGtcPendingScheduledFeignService;
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.scheduled.RiskSymbolGtcPendingScheduledDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.risk.symbol.gtc.pending.scheduled.RiskSymbolGtcPendingScheduledAddEntity;
import com.crm.rely.backend.core.entity.risk.symbol.gtc.pending.scheduled.RiskSymbolGtcPendingScheduledDeleteEntity;
import com.crm.rely.backend.core.entity.risk.symbol.gtc.pending.scheduled.RiskSymbolGtcPendingScheduledSearchEntity;
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/gtc/pending/scheduled")
public class RiskSymbolGtcPendingScheduledController {

    @Autowired
    private RiskSymbolGtcPendingScheduledFeignService feignService;

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

        return feignService.add(entity);
    }

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

        return feignService.delete(entity);
    }

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

        return feignService.pageList(entity);
    }

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

        return feignService.single(entity);
    }

}
