package com.crm.manager.controller;

import com.crm.manager.service.follow.FollowCptInfoFeignService;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.BaseResultWithPagerDto;
import com.crm.rely.backend.core.dto.follow.cpt.FollowCptInfoDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.follow.cpt.FollowCptInfoAddEntity;
import com.crm.rely.backend.core.entity.follow.cpt.FollowCptInfoSearchEntity;
import com.crm.rely.backend.core.entity.follow.cpt.FollowCptInfoUpdateEntity;
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;

import java.util.List;

@RestController
@RequestMapping("/follow/cpt/info")
public class FollowCptInfoController {

    @Autowired
    private FollowCptInfoFeignService followCptInfoFeignService;

    @PostMapping("/add")
    public BaseResultDto<Object> add(@RequestBody @Validated FollowCptInfoAddEntity entity) throws Exception {
        return followCptInfoFeignService.add(entity);
    }

    @PostMapping("/update")
    public BaseResultDto<Object> update(@RequestBody @Validated FollowCptInfoUpdateEntity entity) throws Exception {
        return followCptInfoFeignService.update(entity);
    }

    @PostMapping("/delete")
    public BaseResultDto<Object> delete(@RequestBody @Validated SingleLongEntity entity) throws Exception {
        return followCptInfoFeignService.delete(entity);
    }

    @PostMapping("/search/single")
    public BaseResultDto<FollowCptInfoDto> searchSingle(@RequestBody @Validated SingleLongEntity entity) throws Exception {
        return followCptInfoFeignService.searchSingle(entity);
    }

    @PostMapping("/search/list")
    public BaseResultWithPagerDto<List<FollowCptInfoDto>> searchList(@RequestBody FollowCptInfoSearchEntity entity) throws Exception {
        return followCptInfoFeignService.searchList(entity);
    }

}
