package org.framework.lazy.cloud.network.heartbeat.server.standalone.controller;


import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.LazyInternalNetworkPenetrationMappingApplication;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.internal.network.penetration.mapping.*;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.internal.network.penetration.mapping.*;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.dto.LazyInternalNetworkPenetrationMappingDTO;
import org.springframework.validation.annotation.Validated;
import org.wu.framework.web.response.mark.ValidType;
import org.wu.framework.web.spring.EasyController;
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
import org.wu.framework.web.response.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyController;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.internal.network.penetration.mapping.LazyInternalNetworkPenetrationMapping;

import java.util.List;

/**
 * describe 内网穿透映射
 *
 * @author Jia wei Wu
 * @date 2023/12/29 05:21 下午
 * @see DefaultDDDLazyController
 **/
@Tag(name = "内网穿透映射提供者")
@EasyController("/internal/network/penetration/mapping")
public class LazyInternalNetworkPenetrationMappingProvider {

    @Resource
    private LazyInternalNetworkPenetrationMappingApplication lazyInternalNetworkPenetrationMappingApplication;

    /**
     * describe 新增内网穿透映射
     *
     * @param lazyInternalNetworkPenetrationMappingStoryCommand 新增内网穿透映射
     * @return {@link Result< LazyInternalNetworkPenetrationMapping >} 内网穿透映射新增后领域对象
     * @author Jia wei Wu
     * @date 2023/12/29 05:21 下午
     **/

    @Operation(summary = "新增内网穿透映射")
    @PostMapping("/story")
    public Result<LazyInternalNetworkPenetrationMapping> story(@RequestBody LazyInternalNetworkPenetrationMappingStoryCommand lazyInternalNetworkPenetrationMappingStoryCommand)  {
        return lazyInternalNetworkPenetrationMappingApplication.story(lazyInternalNetworkPenetrationMappingStoryCommand);
    }

    /**
     * describe 批量新增内网穿透映射
     *
     * @param lazyInternalNetworkPenetrationMappingStoryCommandList 批量新增内网穿透映射
     * @return {@link Result<List< LazyInternalNetworkPenetrationMapping >>} 内网穿透映射新增后领域对象集合
     * @author Jia wei Wu
     * @date 2023/12/29 05:21 下午
     **/

    @Operation(summary = "批量新增内网穿透映射")
    @PostMapping("/batchStory")
    public Result<List<LazyInternalNetworkPenetrationMapping>> batchStory(@RequestBody List<LazyInternalNetworkPenetrationMappingStoryCommand> lazyInternalNetworkPenetrationMappingStoryCommandList) {
        return lazyInternalNetworkPenetrationMappingApplication.batchStory(lazyInternalNetworkPenetrationMappingStoryCommandList);
    }

    /**
     * describe 更新内网穿透映射
     *
     * @param lazyInternalNetworkPenetrationMappingUpdateCommand 更新内网穿透映射
     * @return {@link Result< LazyInternalNetworkPenetrationMapping >} 内网穿透映射领域对象
     * @author Jia wei Wu
     * @date 2023/12/29 05:21 下午
     **/

    @Operation(summary = "更新内网穿透映射")
    @PutMapping("/updateOne")
    public Result<LazyInternalNetworkPenetrationMapping> updateOne(
            @Validated(ValidType.Update.class)
            @RequestBody LazyInternalNetworkPenetrationMappingUpdateCommand lazyInternalNetworkPenetrationMappingUpdateCommand) {
        return lazyInternalNetworkPenetrationMappingApplication.updateOne(lazyInternalNetworkPenetrationMappingUpdateCommand);
    }

    /**
     * describe 查询单个内网穿透映射
     *
     * @param lazyInternalNetworkPenetrationMappingQueryOneCommand 查询单个内网穿透映射
     * @return {@link Result< LazyInternalNetworkPenetrationMappingDTO >} 内网穿透映射DTO对象
     * @author Jia wei Wu
     * @date 2023/12/29 05:21 下午
     **/

    @Operation(summary = "查询单个内网穿透映射")
    @GetMapping("/findOne")
    public Result<LazyInternalNetworkPenetrationMappingDTO> findOne(@ModelAttribute LazyInternalNetworkPenetrationMappingQueryOneCommand lazyInternalNetworkPenetrationMappingQueryOneCommand) {
        return lazyInternalNetworkPenetrationMappingApplication.findOne(lazyInternalNetworkPenetrationMappingQueryOneCommand);
    }

    /**
     * describe 查询多个内网穿透映射
     *
     * @param lazyInternalNetworkPenetrationMappingQueryListCommand 查询多个内网穿透映射
     * @return {@link Result<List< LazyInternalNetworkPenetrationMappingDTO >>} 内网穿透映射DTO对象
     * @author Jia wei Wu
     * @date 2023/12/29 05:21 下午
     **/

    @Operation(summary = "查询多个内网穿透映射")
    @GetMapping("/findList")
    public Result<List<LazyInternalNetworkPenetrationMappingDTO>> findList(@ModelAttribute LazyInternalNetworkPenetrationMappingQueryListCommand lazyInternalNetworkPenetrationMappingQueryListCommand) {
        return lazyInternalNetworkPenetrationMappingApplication.findList(lazyInternalNetworkPenetrationMappingQueryListCommand);
    }

    /**
     * describe 分页查询多个内网穿透映射
     *
     * @param lazyInternalNetworkPenetrationMappingQueryListCommand 分页查询多个内网穿透映射
     * @return {@link Result<LazyPage< LazyInternalNetworkPenetrationMappingDTO >>} 分页内网穿透映射DTO对象
     * @author Jia wei Wu
     * @date 2023/12/29 05:21 下午
     **/

    @Operation(summary = "分页查询多个内网穿透映射")
    @GetMapping("/findPage")
    public Result<LazyPage<LazyInternalNetworkPenetrationMappingDTO>> findPage(@Parameter(description = "分页大小") @RequestParam(defaultValue = "10", value = "size") int size,
                                                                               @Parameter(description = "当前页数") @RequestParam(defaultValue = "1", value = "current") int current, @ModelAttribute LazyInternalNetworkPenetrationMappingQueryListCommand lazyInternalNetworkPenetrationMappingQueryListCommand) {
        return lazyInternalNetworkPenetrationMappingApplication.findPage(size, current, lazyInternalNetworkPenetrationMappingQueryListCommand);
    }

    /**
     * describe 删除内网穿透映射
     *
     * @param lazyInternalNetworkPenetrationMappingRemoveCommand 删除内网穿透映射
     * @return {@link Result< LazyInternalNetworkPenetrationMapping >} 内网穿透映射
     * @author Jia wei Wu
     * @date 2023/12/29 05:21 下午
     **/

    @Operation(summary = "删除内网穿透映射")
    @DeleteMapping("/remove")
    public Result<LazyInternalNetworkPenetrationMapping> remove(
            @Validated(ValidType.Delete.class)
            @ModelAttribute LazyInternalNetworkPenetrationMappingRemoveCommand lazyInternalNetworkPenetrationMappingRemoveCommand) {
        return lazyInternalNetworkPenetrationMappingApplication.remove(lazyInternalNetworkPenetrationMappingRemoveCommand);
    }
}