package jnpf.attendance.fallback;

import jnpf.attendance.FtbStatisticsApi;
import jnpf.attendance.dto.*;
import jnpf.base.ActionResult;
import jnpf.model.attendance.dto.DayStatisticsDto;
import jnpf.model.attendance.dto.SalaryAttendanceSupportDto;
import jnpf.model.attendance.vo.attendance.AttendanceCustomizeTableVo;
import jnpf.model.attendance.vo.attendance.DayStatisticsPageListVo;
import jnpf.model.attendance.vo.attendance.DayStatisticsVo;
import jnpf.model.attendance.vo.attendance.SalaryAttendanceSupportVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

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

@Slf4j
@Component
public class FtbStatisticsApiFallback implements FallbackFactory<FtbStatisticsApi> {
    @Override
    public FtbStatisticsApi create(Throwable cause) {
        // 打印降级原因
        log.error("进入 FtbStatisticsApi 的 fallback，降级原因：", cause);
        return new FtbStatisticsApi() {
            @Override
            public ActionResult<Boolean> userDayStatisticsInit(String tenantId) {
                return ActionResult.success(Boolean.FALSE);
            }

            @Override
            public ActionResult<Boolean> dayStatisticsNotice(String tenantId) {
                return ActionResult.success(Boolean.FALSE);
            }

            @Override
            public ActionResult<Boolean> monthStatisticsNotice(String tenantId) {
                return ActionResult.success(Boolean.FALSE);
            }

            @Override
            public ActionResult<Boolean> teamMonthStatisticsNotice(String tenantId) {
                return ActionResult.success(Boolean.FALSE);
            }

            @Override
            public void consentUnscheduledNotice(String tenantId) {

            }

            @Override
            public ActionResult<Boolean> autoSealTimer(String tenantId) {
                return ActionResult.success(Boolean.FALSE);
            }

            @Override
            public List<AttendanceCountAvgHoursVo> countAttendanceAvgHours(AttendanceCountAvgHoursDto dto) {
                return List.of();
            }

            @Override
            public ActionResult<MonthStatsDetailsVo> getAttendanceAvgHoursDetails(MonthStatsDetailsDto dto) {
                return ActionResult.success(null);
            }

            @Override
            public ActionResult<List<MonthStatsPerCapitaVo>> getAttendanceMonthPerCapita(MonthStatsDetailsDto dto) {
                return ActionResult.success(List.of());
            }

            @Override
            public ActionResult<List<MonthStatsDailySituationVo>> getAttendanceDailySituation(MonthStatsDetailsDto dto) {
                return ActionResult.success(List.of());
            }

            @Override
            public ActionResult<List<MonthStatsHoursRankingVo>> getAttendanceHoursRanking(MonthStatsDetailsDto dto) {
                return ActionResult.success(List.of());
            }

            @Override
            public ActionResult<List<MonthStatsFullSituationVo>> getAttendanceFullSituation(MonthStatsDetailsDto dto) {
                return ActionResult.success(List.of());
            }

            @Override
            public ActionResult<MonthStatsAbnormalConditionVo> getAttendanceAbnormalCondition(MonthStatsDetailsDto dto) {
                return ActionResult.success(null);
            }

            @Override
            public ActionResult<List<MonthStatsOvertimeSituationVo>> getAttendanceOvertimeSituation(MonthStatsDetailsDto dto) {
                return ActionResult.success(List.of());
            }

            @Override
            public Map<String, SalaryAttendanceSupportVo> salaryAttendanceSupport(SalaryAttendanceSupportDto dto) {
                return Map.of();
            }

            @Override
            public List<AttendanceCustomizeTableVo> attendanceDayStaTable() {
                return List.of();
            }

            @Override
            public List<DayStatisticsPageListVo> attendanceDayStaList(SalaryAttendanceSupportDto dto) {
                return List.of();
            }

            @Override
            public List<DayStatisticsVo> getAttendanceDayStaList(DayStatisticsDto dto) {
                return List.of();
            }

            @Override
            public Map<String, List<DateDimensionsRangeVo>> getDimensionsAttendanceCountMap(DimensionsAttendanceCountDto dto) {
                return Map.of();
            }

            @Override
            public Map<String, Map<Date, Integer>> getDimensionsAttendanceDayCountMap(DimensionsAttendanceDayCountDto dto) {
                return Map.of();
            }
        };
    }
}
