package com.crm.manager.controller;

import com.crm.manager.service.activity.CustomActivityMidyearTenPercentGiveFeignService;
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.midyear.ten.percent.give.CustomActivityMidyearTenPercentGiveDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.custom.activity.midyear.ten.percent.give.CustomActivityMidyearTenPercentGiveDeleteEntity;
import com.crm.rely.backend.core.entity.custom.activity.midyear.ten.percent.give.CustomActivityMidyearTenPercentGiveSearchEntity;
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/midyear/ten/percent/give")
public class CustomActivityMidyearTenPercentGiveController {

    @Autowired
    private CustomActivityMidyearTenPercentGiveFeignService feignService;


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

        return feignService.delete(entity);
    }

    @PostMapping("/cancel")
    public BaseResultDto cancelActivity(@RequestBody @Validated SingleLongEntity entity) throws Exception {

        return feignService.cancelActivity(entity);
    }

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

        return feignService.searcherList(entity);
    }

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

        return feignService.searcherSingle(entity);
    }
}
