package com.crm.manager.controller;

import com.crm.manager.service.golden.GoldenRewardQuestionFeignService;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.model.dto.golden.question.GoldenRewardQuestionListDto;
import com.crm.rely.backend.model.entity.golden.question.GoldenRewardQuestionAddEntity;
import com.crm.rely.backend.model.entity.golden.question.GoldenRewardQuestionDeleteEntitys;
import com.crm.rely.backend.model.entity.golden.question.GoldenRewardQuestionSearchEntity;
import com.crm.rely.backend.model.entity.golden.question.GoldenRewardQuestionUpdateEntity;
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("/reward/question")
public class GoldenRewardQuestionController {

    @Autowired
    private GoldenRewardQuestionFeignService goldenRewardQuestionService;

    @PostMapping("/add")
    public BaseResultDto add(@RequestBody @Validated GoldenRewardQuestionAddEntity entity) throws Exception {

        return goldenRewardQuestionService.add(entity);
    }

    @PostMapping("/delete")
    public BaseResultDto delete(@RequestBody @Validated GoldenRewardQuestionDeleteEntitys entitys) throws Exception {

        return goldenRewardQuestionService.delete(entitys);
    }

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

        return goldenRewardQuestionService.update(entity);
    }

    @PostMapping("/search/list")
    public ResultWithPagerDto<GoldenRewardQuestionListDto> pageList(@RequestBody GoldenRewardQuestionSearchEntity entity) throws Exception {
        return goldenRewardQuestionService.searchPageList(entity);
    }

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

}
