package com.crm.manager.controller;

import com.crm.manager.service.activity.WebActivityOcAreaFeignService;
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.web.activity.oc.WebActivityOcAreaListDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.web.activity.oc.WebActivityOcAreaAddEntity;
import com.crm.rely.backend.core.entity.web.activity.oc.WebActivityOcAreaDeleteEntitys;
import com.crm.rely.backend.core.entity.web.activity.oc.WebActivityOcAreaSearchEntity;
import com.crm.rely.backend.core.entity.web.activity.oc.WebActivityOcAreaUpdateEntity;
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("/web/oc/area")
public class WebActivityOcAreaController {

    @Autowired
    private WebActivityOcAreaFeignService webActivityOcAreaService;

    @PostMapping("/add")
    public BaseResultDto add(@RequestBody @Validated WebActivityOcAreaAddEntity entity) throws Exception {
        return webActivityOcAreaService.add(entity);
    }

    @PostMapping("/delete")
    public BaseResultDto delete(@RequestBody @Validated WebActivityOcAreaDeleteEntitys entitys) throws Exception {
        return webActivityOcAreaService.delete(entitys);
    }

    @PostMapping("/update")
    public BaseResultDto update(@RequestBody @Validated WebActivityOcAreaUpdateEntity entity) throws Exception {
        return webActivityOcAreaService.update(entity);
    }

    @PostMapping("/search/list")
    public ResultWithPagerDto<WebActivityOcAreaListDto> pageList(@RequestBody WebActivityOcAreaSearchEntity entity) throws Exception {
        return webActivityOcAreaService.searchPageList(entity);
    }

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

    @PostMapping("/all/list")
    public BaseResultDto getAllList(@RequestBody WebActivityOcAreaSearchEntity entity) throws Exception {
        return webActivityOcAreaService.getAllList(entity);
    }

}
