package com.atlassian.bitbucket.mesh.repair;

import com.atlassian.bitbucket.mesh.git.Reflog;

import javax.annotation.Nonnull;
import java.util.Comparator;
import java.util.Objects;
import java.util.function.BiPredicate;

class ReflogDiffer extends Differ<Reflog> {

    private static final Comparator<Reflog> REFLOG_COMPARATOR = Comparator.comparing(Reflog::getRefId);
    private static final BiPredicate<Reflog, Reflog> REFLOG_EQUALITY =
            (from, to) -> Objects.equals(from.getRefId(), to.getRefId()) && from.getSize() == to.getSize();

    ReflogDiffer(@Nonnull DiffCallback<Reflog> callback) {
        super(REFLOG_COMPARATOR, REFLOG_EQUALITY, callback);
    }
}
