package com.crm.manager.controller;

import com.crm.manager.service.activity.CustomActivityDepositGiveFeignService;
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.deposit.CustomActivityDepositGiveDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.custom.activity.deposit.CustomActivityDepositGiveDeleteEntity;
import com.crm.rely.backend.core.entity.custom.activity.deposit.CustomActivityDepositGiveSearchEntity;
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/deposit/give")
public class CustomActivityDepositGiveController {

    @Autowired
    private CustomActivityDepositGiveFeignService feignService;


    @PostMapping("/delete")
    public BaseResultDto delete(@RequestBody @Validated CustomActivityDepositGiveDeleteEntity 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<CustomActivityDepositGiveDto> searcherList(@RequestBody @Validated CustomActivityDepositGiveSearchEntity entity) throws Exception {

        return feignService.searcherList(entity);
    }

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

        return feignService.searcherSingle(entity);
    }
}
