package com.ycwl.basic.service.pc.strategy.impl;

import com.ycwl.basic.service.pc.strategy.RematchContext;
import com.ycwl.basic.service.pc.strategy.RematchModeStrategy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 重匹配模式1策略
 * 条件: tourMatch || recognitionCount > 1 || hasLowThreshold
 * 满足任一条件即可重匹配
 *
 * @author longbinbin
 * @date 2025-01-31
 */
@Slf4j
@Component
public class RematchMode1Strategy implements RematchModeStrategy {

    @Override
    public boolean shouldRematch(RematchContext context) {
        boolean result = context.isTourMatch()
                || context.getRecognitionCount() > 1
                || context.isHasLowThreshold();

        log.debug("RematchMode1Strategy判断: tourMatch={}, recognitionCount={}, hasLowThreshold={}, result={}",
                context.isTourMatch(), context.getRecognitionCount(),
                context.isHasLowThreshold(), result);

        return result;
    }

    @Override
    public int getMode() {
        return 1;
    }
}
