package com.muyu.rule.remote.Factory;

import com.muyu.common.core.domain.Result;
import com.muyu.etl.domain.DataValue;

import com.muyu.rule.common.domain.DataValueFie;
import com.muyu.rule.common.domain.DataValueRow;
import com.muyu.rule.common.domain.DataValueRows;
import com.muyu.rule.common.domain.RuleEngineVersion;
import com.muyu.rule.remote.RuleFeign;
import lombok.extern.log4j.Log4j2;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Log4j2
@Component
public class RuleFactory implements FallbackFactory<RuleFeign> {

    @Override
    public RuleFeign create(Throwable cause) {
        return new RuleFeign() {
            @Override
            public Result<RuleEngineVersion> findVersionById(Long id) {
                log.info(cause);
                return Result.error("网络开小差......");
            }

            @Override
            public Result<DataValue> testEngine(String className, DataValueFie dataValue) {
                log.info(cause);
                return Result.error("网络开小差......");
            }

            @Override
            public Result<DataValue[]> testEngine(String className, DataValueRow dataValue) {
                log.info(cause);
                return Result.error("网络开小差......");
            }

            @Override
            public Result<DataValue[][]> DataSetEngine(String className, DataValueRows dataValues) {
                log.info(cause);
                return Result.error("网络开小差......");
            }
        };
    }
}
