package com.bonus.canteen.core.drp.controller;

import com.bonus.canteen.core.common.page.PageVO;
import com.bonus.canteen.core.drp.dto.DrpCertificatePageDto;
import com.bonus.canteen.core.drp.service.DrpCertificateService;
import com.bonus.canteen.core.drp.vo.DrpCertificateVo;
import com.bonus.common.core.web.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Lazy;
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;

import javax.annotation.Resource;

@RestController
@Api(
   tags = {"证书库"}
)
@RequestMapping({"/api/v1/drp-cert"})
public class DrpCertificateController {
   @Resource
   @Lazy
   private DrpCertificateService drpCertificateService;

   @PostMapping({"/page-cert"})
   @ApiOperation("分页查询证书库")
   public AjaxResult pageDrpCertificate(@RequestBody DrpCertificatePageDto dto) {
      PageVO<DrpCertificateVo> page = this.drpCertificateService.pageDrpCertificate(dto);
      return AjaxResult.success(page);
   }

//   @PostMapping({"/add-cert"})
//   @ApiOperation("新增证书库")
//   public LeResponse<Void> addDrpCertificate(@Validated({ValidationGroups.Insert.class}) @RequestBody LeRequest<DrpCertificateDto> request) {
//      this.drpCertificateService.addDrpCertificate((DrpCertificateDto)request.getContent());
//      return LeResponse.succ();
//   }
//
//   @PostMapping({"/edit-cert"})
//   @ApiOperation("编辑证书库")
//   public LeResponse<Void> editDrpCertificate(@Validated({ValidationGroups.Update.class}) @RequestBody LeRequest<DrpCertificateDto> request) {
//      this.drpCertificateService.editDrpCertificate((DrpCertificateDto)request.getContent());
//      return LeResponse.succ();
//   }
//
//   @PostMapping({"/del-cert"})
//   @ApiOperation("删除证书库")
//   public LeResponse<Void> delDrpCertificate(@RequestBody LeRequest<Long> request) {
//      this.drpCertificateService.delDrpCertificate((Long)request.getContent());
//      return LeResponse.succ();
//   }
}
