package com.hdkj.lt.feign.fallback;

import com.hdkj.lt.feign.ISimulationPlatformApiClient;
import com.hdkj.lt.modle.dto.simulation.ElectricalModelRequest;
import com.hdkj.lt.modle.dto.simulation.ElectricalModelResponse;
import com.hdkj.lt.modle.dto.simulation.FaultTransferSchemeDTO;
import com.hdkj.lt.modle.dto.simulation.OperationSchemeDTO;
import com.hdkj.lt.modle.dto.simulation.PlanTransferSchemeDTO;
import com.hdkj.hussar.ApiResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author rj
 * @date 2025/5/26 下午2:23
 * @description
 */
@Slf4j
@Component
public class SimulationPlatformApiClientFallBack implements FallbackFactory<ISimulationPlatformApiClient> {
    @Override
    public ISimulationPlatformApiClient create(Throwable cause) {
        return new ISimulationPlatformApiClient() {
            @Override
            public String getFaultTransferScheme(FaultTransferSchemeDTO dto) {
                log.error("推演平台-getPlanTransferScheme 远程调用服务异常, 参数:{},异常:{}", dto, cause.getMessage());
                return "推演平台-getPlanTransferScheme 远程调用服务异常";
            }

            @Override
            public String getPlanTransferScheme(PlanTransferSchemeDTO planTransferSchemeDTO) {
                return null;
            }

            @Override
            public String getOperationScheme(OperationSchemeDTO operationSchemeDTO) {
                return "推演平台服务异常";
            }

            @Override
            public String getElectricalModel(ElectricalModelRequest request) {
                log.error("配网电气模型接口-远程调用服务异常, 参数:{},异常:{}", request, cause.getMessage());
                return null;
            }
        };
    }
}
