package com.crunii.micro.feign.client.fallbackfactory;

import com.crunii.micro.common.dto.Result;
import com.crunii.micro.domain.dto.message.PushMsgTemplateReqBo;
import com.crunii.micro.domain.dto.message.SaveMessageTaskReqBo;
import com.crunii.micro.domain.dto.message.SendMessageTaskReqDTO;
import com.crunii.micro.feign.client.MessageCommonService;
import com.crunii.micro.feign.client.MessageService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @Author thw
 * @date 2023/11/28
 * @description
 */
@Component
public class MessageCommonServiceFactory implements FallbackFactory<MessageCommonService> {

  private static final Logger logger = LoggerFactory.getLogger(MessageCommonServiceFactory.class);
  @Override
  public MessageCommonService create(Throwable cause) {
    logger.error("fallback; exception was: {}", cause.toString());
    logger.error("fallback; reason was: {}", cause.getMessage());
    return new MessageCommonService() {
/*      @Override
      public Result saveMessage(SaveMessageTaskReqBo taskReqDto) {
        Result<String> result = new Result();
        result.setSuccess(false);
        result.setMsg("saveMessage接口调用失败");
        return result;
      }*/

      @Override
      public Result pushMsg(PushMsgTemplateReqBo templateBo, Long userId) {
        Result<String> result = new Result();
        result.setSuccess(false);
        result.setMsg("pushMsg接口调用失败");
        return result;
      }
    };
  }
}
