package com.crm.manager.controller;

import com.crm.manager.service.activity.CustomActivityTwoPercentGiveAgentFeignService;
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.custom.activity.two.percent.give.agent.CustomActivityTwoPercentGiveAgentDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.custom.activity.two.percent.give.agent.CustomActivityTwoPercentGiveAgentAddEntity;
import com.crm.rely.backend.core.entity.custom.activity.two.percent.give.agent.CustomActivityTwoPercentGiveAgentDeleteEntity;
import com.crm.rely.backend.core.entity.custom.activity.two.percent.give.agent.CustomActivityTwoPercentGiveAgentSearchEntity;
import lombok.extern.log4j.Log4j;
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
 */
@Log4j
@RestController
@RequestMapping("/custom/activity/two/percent/give/agent")
public class CustomActivityTwoPercentGiveAgentController {

    @Autowired
    private CustomActivityTwoPercentGiveAgentFeignService service;

    @PostMapping("/add")
    public BaseResultDto add(@RequestBody @Validated CustomActivityTwoPercentGiveAgentAddEntity entity) throws Exception {

        return service.add(entity);
    }


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

        return service.delete(entity);
    }


    @PostMapping("/search/list")
    public ResultWithPagerDto<CustomActivityTwoPercentGiveAgentDto> searcherList(@RequestBody @Validated CustomActivityTwoPercentGiveAgentSearchEntity entity) throws Exception {

        return service.searcherList(entity);
    }

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

        return service.searcherSingle(entity);
    }
}
