package com.crm.manager.controller;

import com.crm.manager.service.activity.CustomActivityExceptionalManageFeignService;
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.exceptional.manager.CustomActivityExceptionalManagerDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.custom.exceptional.manager.CustomActivityExceptionalManagerAddEntity;
import com.crm.rely.backend.core.entity.custom.exceptional.manager.CustomActivityExceptionalManagerSearchEntity;
import com.crm.rely.backend.core.entity.custom.exceptional.manager.CustomActivityExceptionalManagerUpdateEntity;
import com.crm.rely.backend.exception.ServiceException;
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;

@RestController
@RequestMapping("/custom/activity/exceptional/manager")
public class CustomActivityExceptionalManageController {

    @Autowired
    private CustomActivityExceptionalManageFeignService service;

    @PostMapping("/add")
    public BaseResultDto<Object> add(@RequestBody @Validated CustomActivityExceptionalManagerAddEntity entity) throws ServiceException {

        return service.add(entity);
    }

    @PostMapping("/search/single")
    public BaseResultDto<CustomActivityExceptionalManagerDto> single(@RequestBody SingleLongEntity entity) throws ServiceException {

        return service.single(entity);
    }

    @PostMapping("/search/list")
    public ResultWithPagerDto<CustomActivityExceptionalManagerDto> searchPageList(@RequestBody CustomActivityExceptionalManagerSearchEntity entity) throws ServiceException {
        return service.searchPageList(entity);

    }

    @PostMapping("/close")
    public BaseResultDto close(@RequestBody CustomActivityExceptionalManagerUpdateEntity entity) throws ServiceException {

        return service.close(entity);
    }

    @PostMapping("/update")
    public BaseResultDto update(@RequestBody CustomActivityExceptionalManagerUpdateEntity entity) throws ServiceException {

        return service.update(entity);
    }
}
