package com.crm.manager.controller;

import com.crm.manager.service.activity.WebActivityOcScheduledFeignService;
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.WebActivityOcScheduledDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.web.activity.oc.*;
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/scheduled")
public class WebActivityOcScheduledController {

    @Autowired
    private WebActivityOcScheduledFeignService service;

    /**
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/add")
    public BaseResultDto add(@RequestBody @Validated WebActivityOcScheduledAddEntity entity) throws Exception {

        return service.add(entity);
    }

    @PostMapping("/update")
    public BaseResultDto update(@RequestBody @Validated WebActivityOcScheduledUpdateEntity entity) throws Exception {

        return service.update(entity);
    }

    @PostMapping("/delete")
    public BaseResultDto delete(@RequestBody @Validated WebActivityOcScheduledDeleteEntity entity) throws Exception {
        return service.delete(entity);
    }

    @PostMapping("/search/list")
    public ResultWithPagerDto<WebActivityOcScheduledDto> pageList(@RequestBody @Validated WebActivityOcScheduledSearchEntity entity) throws Exception {
        return service.searchPageList(entity);
    }

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

}
