import {
  DEFAULT_SESSION_RENEW_THROTTLE_MS,
  type SessionRenewDecisionParams,
  shouldAttemptSlidingSessionRenew as shouldAttemptSlidingSessionRenewBase,
  shouldAttemptUnlimitedSessionRenew as shouldAttemptUnlimitedSessionRenewBase,
} from "../../../common/core/session";

export const SESSION_RENEW_THROTTLE_MS = DEFAULT_SESSION_RENEW_THROTTLE_MS;
export const SESSION_RENEW_THRESHOLD_MS = 5 * 60 * 1000;

export function shouldAttemptSlidingSessionRenew(
  params: SessionRenewDecisionParams,
) {
  return shouldAttemptSlidingSessionRenewBase({
    ...params,
    thresholdMs: params.thresholdMs ?? SESSION_RENEW_THRESHOLD_MS,
  });
}

export function shouldAttemptUnlimitedSessionRenew(
  params: SessionRenewDecisionParams,
) {
  return shouldAttemptUnlimitedSessionRenewBase({
    ...params,
    thresholdMs: params.thresholdMs ?? SESSION_RENEW_THRESHOLD_MS,
  });
}
