package com.yuchen.saas.park.api.feign.building;

import com.yuchen.saas.park.api.dto.building.PmgBatBuildingDynamicQueryDto;
import com.yuchen.saas.park.api.util.SaasParkFeignFallbackUtils;
import com.yuchen.saas.park.api.vo.building.PmgBatBuildingDynamicDetailVO;
import com.yuchen.saas.park.api.vo.building.PmgBatBuildingDynamicPageVO;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.mp.support.NestPage;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

/**
 * @Author yuanzhelin
 * @Date 2024/10/31 15:15
 * @Description TODO
 */
@Component
public class PmgBatBuildingDynamicFallback implements FallbackFactory<PmgBatBuildingDynamicClient> {
    @Override
    public PmgBatBuildingDynamicClient create(Throwable throwable) {
        return new PmgBatBuildingDynamicClient() {
            @Override
            public R<NestPage<PmgBatBuildingDynamicPageVO>> page(PmgBatBuildingDynamicQueryDto dto) {
                return SaasParkFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<PmgBatBuildingDynamicDetailVO> detail(Long id) {
                return SaasParkFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R increaseShare(Long id) {
                return SaasParkFeignFallbackUtils.printLogAndReturn(throwable);
            }
        };
    }
}
