package com.crm.manager.controller;

import com.crm.manager.service.follow.FollowCptLuckyFeignService;
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.FollowCptLuckyDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.follow.cpt.FollowCptLuckySearchEntity;
import com.crm.rely.backend.core.entity.follow.cpt.FollowCptLuckyUpdateEntity;
import org.springframework.beans.factory.annotation.Autowired;
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/lucky")
public class FollowCptLuckyController {

    @Autowired
    private FollowCptLuckyFeignService followCptLuckyFeignService;

    @PostMapping("/search/list")
    public BaseResultWithPagerDto<List<FollowCptLuckyDto>> searchList(@RequestBody FollowCptLuckySearchEntity entity) throws Exception {
        return followCptLuckyFeignService.searchList(entity);
    }

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

    @PostMapping("/update/status")
    public BaseResultDto<Object> searchList(@RequestBody FollowCptLuckyUpdateEntity entity) throws Exception {
        entity.setStatus(2);
        return followCptLuckyFeignService.updateStatus(entity);
    }

}
