from apps.subscriptions.models import Plan, PlanType
from django.conf import settings

def monthly_plans(request):
    plans = Plan.objects.filter(plan_duration=PlanType.Monthly)
    return {'monthly_plans':plans}

def yearly_plans(request):
    plans = Plan.objects.filter(plan_duration=PlanType.Yearly)
    return {'yearly_plans':plans}

def weekly_plans(request):
    plans = Plan.objects.filter(plan_duration=PlanType.Weekly)
    return {'weekly_plans':plans}

def get_plans(request):
    return {"plans":zip(
        Plan.objects.filter(plan_duration=PlanType.Weekly), 
        Plan.objects.filter(plan_duration=PlanType.Monthly),
        Plan.objects.filter(plan_duration=PlanType.Yearly)
        )
    }

def paypal_info(request):
    return {
        "CLIENT_ID":settings.PAYPAL_CLIENTID
    }