package jnpf.attendance.fallback;

import jnpf.attendance.FtbClockInApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 打卡api fallback
 *
 * @author yanwenfu
 * @create 2023-12-04
 */
@Slf4j
@Component
public class FtbClockInApiFallback implements FallbackFactory<FtbClockInApi> {

    @Override
    public FtbClockInApi create(Throwable cause) {
        cause.printStackTrace();
        return new FtbClockInApi() {

            @Override
            public Boolean dailyRuleChangeExecute() {
                log.error("dailyRuleChangeExecute调用失败...");
                return Boolean.FALSE;
            }

            @Override
            public Boolean generateFtbAbsenceRecord(String tenantId) {
                log.error("generateFtbAbsenceRecord调用失败...");
                return Boolean.FALSE;
            }

            @Override
            public Boolean generateAbsenceTask(String tenantId) {
                log.error("generateAbsenceTask调用失败...");
                return Boolean.FALSE;
            }

            @Override
            public Boolean generateBeforeWorkRemind(String tenantId) {
                log.error("generateBeforeWorkRemind调用失败...");
                return false;
            }

            @Override
            public Boolean generateRepairNum(String tenantId) {
                log.error("生成补卡次数失败...");
                return Boolean.FALSE;
            }

            @Override
            public Boolean continuousCheck(String tenantId) {
                log.error("判定连续动作失败...");
                return Boolean.FALSE;
            }
        };
    }
}
