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

import com.ycwl.basic.integration.common.response.CommonResponse;
import com.ycwl.basic.integration.common.response.PageResponse;
import com.ycwl.basic.integration.scenic.dto.config.*;
import com.ycwl.basic.integration.scenic.dto.filter.ScenicFilterPageResponse;
import com.ycwl.basic.integration.scenic.dto.filter.ScenicFilterRequest;
import com.ycwl.basic.integration.scenic.dto.scenic.CreateScenicRequest;
import com.ycwl.basic.integration.scenic.dto.scenic.ScenicV2DTO;
import com.ycwl.basic.integration.scenic.dto.scenic.UpdateScenicRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

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

@FeignClient(name = "zt-scenic", contextId = "scenic-v2", path = "/api/scenic")
public interface ScenicV2Client {

    // ==================== Scenic V2 Operations ====================

    @GetMapping("v2/{scenicId}")
    CommonResponse<ScenicV2DTO> getScenic(@PathVariable("scenicId") Long scenicId);

    @PostMapping("v2/")
    CommonResponse<ScenicV2DTO> createScenic(@RequestBody CreateScenicRequest request);

    @PutMapping("v2/{scenicId}")
    CommonResponse<ScenicV2DTO> updateScenic(@PathVariable("scenicId") Long scenicId, 
                                           @RequestBody UpdateScenicRequest request);

    @DeleteMapping("v2/{scenicId}")
    CommonResponse<Void> deleteScenic(@PathVariable("scenicId") Long scenicId);

    @PostMapping("v2/filter")
    CommonResponse<ScenicFilterPageResponse> filterScenics(@RequestBody ScenicFilterRequest request);

    @GetMapping("v2/")
    CommonResponse<PageResponse<ScenicV2DTO>> listScenics(@RequestParam(defaultValue = "1") Integer page,
                                                    @RequestParam(defaultValue = "10") Integer pageSize,
                                                    @RequestParam(required = false) Integer status,
                                                    @RequestParam(required = false) String name,
                                                    @RequestParam(required = false) String scenicIds);

    // ==================== Scenic Config V2 Operations ====================

    @GetMapping("config/v2/{scenicId}")
    CommonResponse<List<ScenicConfigV2DTO>> listConfigs(@PathVariable("scenicId") Long scenicId);

    @GetMapping("config/v2/{scenicId}/key/{configKey}")
    CommonResponse<ScenicConfigV2DTO> getConfigByKey(@PathVariable("scenicId") Long scenicId,
                                                     @PathVariable("configKey") String configKey);

    @PostMapping("config/v2/{scenicId}")
    CommonResponse<ScenicConfigV2DTO> createConfig(@PathVariable("scenicId") Long scenicId,
                                                   @RequestBody CreateConfigRequest request);

    @PutMapping("config/v2/{scenicId}/{id}")
    CommonResponse<ScenicConfigV2DTO> updateConfig(@PathVariable("scenicId") Long scenicId,
                                                   @PathVariable("id") String id,
                                                   @RequestBody UpdateConfigRequest request);

    @DeleteMapping("config/v2/{scenicId}/{id}")
    CommonResponse<Void> deleteConfig(@PathVariable("scenicId") Long scenicId,
                                      @PathVariable("id") String id);

    @PostMapping("config/v2/{scenicId}/batch")
    CommonResponse<BatchUpdateResponse> batchUpdateConfigs(@PathVariable("scenicId") Long scenicId,
                                                          @RequestBody BatchConfigRequest request);

    // ==================== Default Config Operations ====================

    @GetMapping("default-config/")
    CommonResponse<List<DefaultConfigDTO>> listDefaultConfigs();

    @GetMapping("default-config/{configKey}")
    CommonResponse<DefaultConfigDTO> getDefaultConfig(@PathVariable("configKey") String configKey);

    @PostMapping("default-config/")
    CommonResponse<DefaultConfigDTO> createDefaultConfig(@RequestBody DefaultConfigDTO request);

    @PutMapping("default-config/{configKey}")
    CommonResponse<DefaultConfigDTO> updateDefaultConfig(@PathVariable("configKey") String configKey,
                                                        @RequestBody DefaultConfigDTO request);

    @DeleteMapping("default-config/{configKey}")
    CommonResponse<Void> deleteDefaultConfig(@PathVariable("configKey") String configKey);
}