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

import com.yuchen.saas.park.api.dto.building.PmgBatBuildingApartmentTypeQryDto;
import com.yuchen.saas.park.api.dto.building.PmgBatBuildingReservationAddDto;
import com.yuchen.saas.park.api.dto.building.PmgBatBuildingReservationConfirmVisitAppDto;
import com.yuchen.saas.park.api.entity.building.PmgBatBuildingApartmentType;
import com.yuchen.saas.park.api.entity.building.PmgBatBuildingReservation;
import com.yuchen.saas.park.api.util.SaasParkFeignFallbackUtils;
import com.yuchen.saas.park.api.vo.building.PmgBatBuildingApartmentTypeCountVO;
import com.yuchen.saas.park.api.vo.building.PmgBatBuildingDetailVO;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author yuanzhelin
 * @Date 2024/10/22 16:19
 * @Description TODO
 */
@Component
public class PmgBatBuildingClientFallback implements FallbackFactory<PmgBatBuildingClient> {
    @Override
    public PmgBatBuildingClient create(Throwable throwable) {
        return new PmgBatBuildingClient() {
            @Override
            public R<List<PmgBatBuildingApartmentType>> apartmentTypeList(PmgBatBuildingApartmentTypeQryDto dto) {
                return SaasParkFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<List<PmgBatBuildingApartmentTypeCountVO>> typeCount(Long projectId) {
                return SaasParkFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<PmgBatBuildingDetailVO> getByProjectId(Long projectId) {
                return SaasParkFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R save(PmgBatBuildingReservationAddDto dto) {
                return SaasParkFeignFallbackUtils.printLogAndReturn(throwable);
            }

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

            @Override
            public R confirmVisitApp(PmgBatBuildingReservationConfirmVisitAppDto dto) {
                return SaasParkFeignFallbackUtils.printLogAndReturn(throwable);
            }

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