import { USER_PLAN_FREE, USER_PLAN_VIP, USER_PLAN_PLUS } from '@/constant/user';

export const PLAN_LEVELS = {
  [USER_PLAN_FREE]: 0,
  [USER_PLAN_VIP]: 1,
  [USER_PLAN_PLUS]: 2,
};

/**
 * @param {string} userPlan
 * @param {string} requiredPlan
 * @returns {boolean}
 */
export const hasPlanAccess = (userPlan, requiredPlan) => {
  return (PLAN_LEVELS[userPlan] || 0) >= (PLAN_LEVELS[requiredPlan] || 0);
};
