// engine/usage-tracker/trial.ts — Trial period logic (pure functions, no I/O).
// ---------------------------------------------------------------------------
// Constants
// ---------------------------------------------------------------------------
/** Number of days in the full trial period. */
export const TRIAL_DAYS = 14;
const MS_PER_DAY = 24 * 60 * 60 * 1000;
// ---------------------------------------------------------------------------
// Trial calculations
// ---------------------------------------------------------------------------
/**
 * Returns the number of whole days elapsed since the given ISO 8601 timestamp.
 */
export function calculateDaysSinceFirstRun(firstRunAt) {
    const firstRunMs = new Date(firstRunAt).getTime();
    const nowMs = Date.now();
    const elapsedMs = nowMs - firstRunMs;
    return Math.floor(elapsedMs / MS_PER_DAY);
}
/**
 * Returns true if the installation is still within the 14-day trial period.
 */
export function isTrialActive(firstRunAt) {
    return calculateDaysSinceFirstRun(firstRunAt) < TRIAL_DAYS;
}
// ---------------------------------------------------------------------------
// Limit resolution
// ---------------------------------------------------------------------------
/**
 * Returns tool/spec/daily-call limits based on the current trial status.
 *
 * - Day 1–14 (trial active):  { tools: 20, specs: 5, dailyCalls: 50 }
 * - Day 15+  (trial expired): { tools: 10, specs: 3, dailyCalls: 30 }
 */
export function getTrialLimits(firstRunAt) {
    if (isTrialActive(firstRunAt)) {
        return { tools: 20, specs: 5, dailyCalls: 50 };
    }
    return { tools: 10, specs: 3, dailyCalls: 30 };
}
//# sourceMappingURL=trial.js.map