package com.inkasso.factoring.system.suggestion.controller;

import com.inkasso.auth.interfaces.Permission;
import com.inkasso.auth.interfaces.Permissions;
import com.inkasso.factoring.system.suggestion.model.request.AddSuggestionRequest;
import com.inkasso.factoring.system.suggestion.service.SuggestionService;
import com.inkasso.adapter.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.PostMapping;

/**
 * @author 张超
 * @date  2023-08-31
 */
@RestController
@RequestMapping(path = "system")
@Permissions(name="建议与反馈",code = "suggestionManage")
public class SuggestionController {

    @Autowired
    private SuggestionService suggestionService;


    @PostMapping(path = "suggestion")
    @Permission(name="添加反馈和意见",code="SuggestionController:add")
    public ResponseData add(@Validated @RequestBody AddSuggestionRequest addSuggestionRequest) {

        suggestionService.addSuggestion(addSuggestionRequest);

        return ResponseData.success();

    }

//    @PutMapping(path = "suggestion")
//    @PermissionAndCheck(name="更新建议与反馈",code="SuggestionController:update")
//    public ResponseData edit(@Validated @RequestBody EditSuggestionRequest editSuggestionRequest) {
//        suggestionService.editSuggestion(editSuggestionRequest);
//        return ResponseData.success();
//    }
//
//    @GetMapping(path = "suggestion/{id}")
//    @PermissionAndCheck(name = "查询建议与反馈详细信息", code="SuggestionController:detail")
//    public ResponseData getById(@PathVariable("id") Long id){
//        if(id==null){
//            throw new ServiceException(400, KafubaoExceptionEnum.SYSTEM_DATE_ERROR);
//        }
//        SuggestionDTO suggestionDTO = suggestionService.getSuggestionDtoById(id);
//        return ResponseData.success(suggestionDTO);
//
//    }
//
//
//    @DeleteMapping(path = "suggestion/{id}")
//    @PermissionAndCheck(name = "删除建议与反馈", code="SuggestionController:delete")
//    public ResponseData deleteById(@PathVariable("id") Long id){
//        if(id==null){
//            throw new ServiceException(400, KafubaoExceptionEnum.SYSTEM_DATE_ERROR);
//        }
//        suggestionService.deleteSuggestion(id);
//        return ResponseData.success();
//    }
}