package com.inkasso.factoring.businessConsulting.controller;

import com.inkasso.adapter.interfaces.Limit;
import com.inkasso.auth.interfaces.Permissions;
import com.inkasso.auth.interfaces.PermissionAndCheck;
import com.inkasso.adapter.page.PageResult;
import com.inkasso.factoring.businessConsulting.model.dto.BusinessConsultingDTO;
import com.inkasso.factoring.businessConsulting.model.request.AddBusinessConsultingRequest;
import com.inkasso.factoring.businessConsulting.model.request.EditBusinessConsultingRequest;
import com.inkasso.factoring.businessConsulting.model.request.QueryBusinessConsultingRequest;
import com.inkasso.factoring.businessConsulting.service.BusinessConsultingService;
import com.inkasso.adapter.exception.ServiceException;
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.PathVariable;
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;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import com.inkasso.adapter.exception.enums.ExceptionEnum;


import java.util.List;

/**
 * @author liutao
 * @date  2024-03-30
 */
@RestController
@RequestMapping(path = "businessconsulting")
@Permissions(name="用户咨询表",code = "businessconsultingManage")
public class BusinessConsultingController {

    @Autowired
    private BusinessConsultingService businessConsultingService;



    @PostMapping(path = "businessconsulting")
    @PermissionAndCheck(name="添加用户咨询表",code="BusinessConsultingController:add")
    @Limit(key = "query",permitsPerSeconds = 1,timeout = 1,msg = "触发接口限流，请重试")
    public ResponseData add(@Validated @RequestBody AddBusinessConsultingRequest addBusinessConsultingRequest) {

        businessConsultingService.addBusinessConsulting(addBusinessConsultingRequest);
        return ResponseData.success();

    }

//    @PutMapping(path = "businessconsulting")
//    @PermissionAndCheck(name="更新用户咨询表",code="BusinessConsultingController:update")
//    public ResponseData edit(@Validated @RequestBody EditBusinessConsultingRequest editBusinessConsultingRequest) {
//        businessConsultingService.editBusinessConsulting(editBusinessConsultingRequest);
//        return ResponseData.success();
//    }
//
//    @GetMapping(path = "businessconsulting/{id}")
//    @PermissionAndCheck(name = "查询用户咨询表详细信息", code="BusinessConsultingController:detail")
//    public ResponseData getById(@PathVariable("id") Long id){
//        if(id==null){
//            throw new ServiceException(400, ExceptionEnum.SYSTEM_DATE_ERROR);
//        }
//        BusinessConsultingDTO businessConsultingDTO = businessConsultingService.getBusinessConsultingDtoById(id);
//        return ResponseData.success(businessConsultingDTO);
//
//    }
//
//
//    @DeleteMapping(path = "businessconsulting/{id}")
//    @PermissionAndCheck(name = "删除用户咨询表", code="BusinessConsultingController:delete")
//    public ResponseData deleteById(@PathVariable("id") Long id){
//        if(id==null){
//            throw new ServiceException(400, ExceptionEnum.SYSTEM_DATE_ERROR);
//        }
//        businessConsultingService.deleteBusinessConsulting(id);
//        return ResponseData.success();
//    }
}