package com.atlassian.stash.internal.auth;

import com.atlassian.stash.internal.Dao;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.concurrent.TimeUnit;

/**
 * @since 3.8
 */
public interface RememberMeTokenDao extends Dao<Long, InternalRememberMeToken> {

    boolean claim(@Nonnull InternalRememberMeToken token);

    int deleteExpiredTokens(long maxExpiredTime, @Nonnull TimeUnit timeUnit);

    int deleteForSeries(@Nonnull String series);

    int deleteForUser(int userId);

    @Nullable
    InternalRememberMeToken findBySeriesAndToken(@Nonnull String series, @Nonnull String value);
}
