package jnpf.attendance.fallback;

import jnpf.attendance.AttendanceGroupApi;
import jnpf.attendance.dto.AttendanceUserGroupVo;
import jnpf.attendance.dto.AttendanceUserListGroupVO;
import jnpf.base.ActionResult;
import jnpf.entity.AttendanceGroup;
import jnpf.model.attendance.vo.AttendanceGroupVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @Title:
 * @Author: peng.hao
 * @create: 2024/4/23:16:09
 */
@Slf4j
@Component
public class AttendanceGroupApiFallback implements FallbackFactory<AttendanceGroupApi> {
    @Override
    public AttendanceGroupApi create(Throwable cause) {
        cause.printStackTrace();
        return new AttendanceGroupApi() {
            @Override
            public AttendanceGroup queryTheNameOfTheAttendanceGroup(String groupId) {
                return new AttendanceGroup();
            }

            @Override
            public List<AttendanceUserGroupVo> getAttendanceUserGroup(List<String> userIds) {
                log.error("AttendanceGroupApiFallback调用getAttendanceUserGroup失败");
                return new ArrayList<>();
            }

            @Override
            public List<AttendanceGroup> getGroupListByOrgId(String organizeId) {
                return null;
            }

            @Override
            public ActionResult<List<AttendanceUserListGroupVO>> getAttendanceUserListGroupVO(List<String> userIds) {
                return null;
            }

            @Override
            public ActionResult<AttendanceGroupVo> getAttendanceGroupByName(String organizeName, String groupName) {
                return null;
            }

            @Override
            public boolean checkScheduling() {
                return false;
            }


        };
    }
}
