package com.crm.manager.controller;

import com.crm.manager.service.activity.CustomActivityGiveFeignService;
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.give.CustomActivityGiveDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.custom.activity.give.CustomActivityGiveDeleteEntity;
import com.crm.rely.backend.core.entity.custom.activity.give.CustomActivityGiveSearchEntity;
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/give")
public class CustomActivityGiveController {

    @Autowired
    private CustomActivityGiveFeignService feignService;


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

        return feignService.searcherList(entity);
    }

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

        return feignService.searcherSingle(entity);
    }
}
