package cn.iocoder.yudao.module.system.controller.admin.extra;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.controller.admin.extra.vo.AuthorizedAgentConfirmationPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.extra.vo.AuthorizedAgentConfirmationRespVO;
import cn.iocoder.yudao.module.system.dal.dataobject.extra.ElderlyExtraAuthorizedAgentConfirmationDO;
import cn.iocoder.yudao.module.system.service.extra.ElderlyExtraAuthorizedAgentConfirmationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 委托代理人确认表")
@RestController @RequestMapping("/elderly/extra/authorizedAgentConfirmation") @Validated
public class ElderlyExtraAuthorizedAgentConfirmationController {
    @Resource private ElderlyExtraAuthorizedAgentConfirmationService service;

    @PostMapping("/create") @Operation(summary = "创建委托代理人确认表")
    public CommonResult<Long> create(@Valid @RequestBody ElderlyExtraAuthorizedAgentConfirmationDO createReqVO) { return success(service.create(createReqVO)); }
    @PostMapping("/update") @Operation(summary = "编辑委托代理人确认表")
    public CommonResult<Boolean> update(@Valid @RequestBody ElderlyExtraAuthorizedAgentConfirmationDO updateReqVO) { service.update(updateReqVO); return success(true); }
    @DeleteMapping("/delete") @Operation(summary = "删除委托代理人确认表") @Parameter(name = "id", required = true)
    public CommonResult<Boolean> delete(@RequestParam("id") Long id) { service.delete(id); return success(true); }
    @GetMapping("/findPage") @Operation(summary = "委托代理人确认表分页列表")
    public CommonResult<PageResult<AuthorizedAgentConfirmationRespVO>> findPage(@Valid AuthorizedAgentConfirmationPageReqVO reqVO) { return success(BeanUtils.toBean(service.findPage(reqVO), AuthorizedAgentConfirmationRespVO.class)); }
    @GetMapping("/getListByElderId") @Operation(summary = "根据长者ID获取委托代理人确认表列表") @Parameter(name = "elderId", required = true)
    public CommonResult<List<ElderlyExtraAuthorizedAgentConfirmationDO>> getListByElderId(@RequestParam("elderId") Long elderId) { return success(service.getListByElderId(elderId)); }
    @GetMapping("/getDetail") @Operation(summary = "获取委托代理人确认表详情") @Parameter(name = "id", required = true)
    public CommonResult<ElderlyExtraAuthorizedAgentConfirmationDO> getDetail(@RequestParam("id") Long id) { return success(service.getDetail(id)); }
}
