package com.ycwl.basic.integration.render.client;

import com.ycwl.basic.integration.common.response.CommonResponse;
import com.ycwl.basic.integration.render.dto.config.BatchRenderWorkerConfigRequest;
import com.ycwl.basic.integration.render.dto.config.RenderWorkerConfigV2DTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 渲染工作器配置V2客户端
 */
@FeignClient(name = "zt-render-worker", contextId = "render-worker-config-v2", path = "/api/render/worker/config/v2")
public interface RenderWorkerConfigV2Client {
    
    /**
     * 获取工作器所有配置
     */
    @GetMapping("/{workerId}")
    CommonResponse<List<RenderWorkerConfigV2DTO>> getWorkerConfigs(@PathVariable("workerId") Long workerId);
    
    /**
     * 根据配置键获取特定配置
     */
    @GetMapping("/{workerId}/key/{configKey}")
    CommonResponse<RenderWorkerConfigV2DTO> getWorkerConfigByKey(@PathVariable("workerId") Long workerId,
                                                                 @PathVariable("configKey") String configKey);
    
    /**
     * 创建配置
     */
    @PostMapping("/{workerId}")
    CommonResponse<RenderWorkerConfigV2DTO> createWorkerConfig(@PathVariable("workerId") Long workerId,
                                                               @RequestBody RenderWorkerConfigV2DTO config);
    
    /**
     * 更新配置
     */
    @PutMapping("/{workerId}/{id}")
    CommonResponse<Void> updateWorkerConfig(@PathVariable("workerId") Long workerId,
                                            @PathVariable("id") Long id,
                                            @RequestBody Map<String, Object> updates);
    
    /**
     * 删除配置
     */
    @DeleteMapping("/{workerId}/{id}")
    CommonResponse<Void> deleteWorkerConfig(@PathVariable("workerId") Long workerId,
                                            @PathVariable("id") Long id);
    
    /**
     * 批量更新配置
     */
    @PostMapping("/{workerId}/batch")
    CommonResponse<Void> batchUpdateWorkerConfigs(@PathVariable("workerId") Long workerId,
                                                  @RequestBody BatchRenderWorkerConfigRequest request);
}