const
Entitlement({ - required PlanTier plan,
- required EntitlementSource source,
- DateTime? expiresAt,
- DateTime? trialExpiresAt,
- DateTime? trialStartedAt,
- @Default(<String, dynamic>{}) Map<String, dynamic> entitlements,
- @Default(<String>[]) List<String> grantsApplied,
- int? aiDailyCap,
- int? aiWeeklyCap,
- int? aiTotalCap,
- @Default(0) int aiBoost,
})
Implementation
const factory Entitlement({
required PlanTier plan,
required EntitlementSource source,
/// End of the current subscription period, if any.
DateTime? expiresAt,
/// Computed trial_started_at + 14 days + any extend_trial grants.
DateTime? trialExpiresAt,
/// Raw trial_started_at from profiles.settings.
DateTime? trialStartedAt,
/// Raw flattened entitlement map from plan_catalog(). Prefer the typed
/// getters below over indexing this directly.
@Default(<String, dynamic>{}) Map<String, dynamic> entitlements,
/// Active admin_grant IDs contributing to this entitlement, for audit.
@Default(<String>[]) List<String> grantsApplied,
/// Null = no daily cap for the plan (e.g. unlimited).
int? aiDailyCap,
/// Null = no weekly cap for the plan.
int? aiWeeklyCap,
/// Null = no total cap. Non-null only for trial users: total AI messages
/// allowed for the entire trial period (e.g. 50).
int? aiTotalCap,
/// Extra AI messages granted via usage_boost grants.
@Default(0) int aiBoost,
}) = _Entitlement;