from django.contrib.auth.models import User
from django import forms
from django.forms import ModelForm

from django.conf import settings
from django.db import models
from django.utils import timezone

from rowers.database import *
import datetime

def current_day():
    return (datetime.datetime.now(tz=timezone.utc)).date()

class Response(models.Model):
    planchoices = (
                   ('basic','Free Athlete'),
                   ('freecoach','Free Coach'),
                   ('pro','Pro'),
                   ('plan','Self-Coach'),
                   ('coach','coach'),
    )
    plan = models.CharField(max_length=150,choices=planchoices,default='basic')
    username = models.CharField(max_length=150,unique=True,verbose_name='User Name',blank=True,null=True)
    email = models.EmailField(max_length=150,verbose_name='User Email',blank=True,null=True)
    date = models.DateField(default=current_day,verbose_name='survey date')
    nrworkouts = models.IntegerField(default=0,verbose_name='nr of workouts per week')
    nrworkoutsR = models.IntegerField(default=0,verbose_name='nr of workouts per week on Rowsandall')

    hearchoices = (
    ('wordofmouth','Word of mouth'),
    ('socialmedia','Social Media (Facebook, Twitter)'),
    ('otherinternet','Other internet'),
    ('coach','From my Coach/Coachee'),
    ('other','Other')
    )

    heard = models.CharField(max_length=150,blank=True,null=True,
                             default=None,
    choices=hearchoices,verbose_name="How did you hear about Rowsandall")

    logging = models.BooleanField(default=False,verbose_name='Logging Workouts')
    technial = models.BooleanField(default=False,verbose_name='Technical Analysis of workouts')
    trend = models.BooleanField(default=False,verbose_name='Trend Analysis of workouts')
    planning = models.BooleanField(default=False,verbose_name='Training planning')
    racing = models.BooleanField(default=False,verbose_name='Online racing')
    coaching = models.BooleanField(default=False,verbose_name='Coaching')
    export = models.BooleanField(default=False,verbose_name='Exporting data to other sites')
    video = models.BooleanField(default=False,verbose_name='Video Analysis')
    interval = models.BooleanField(default=False,verbose_name='Interval editor')

    capabilities = models.NullBooleanField(default=None,null=True,blank=True,
                                           verbose_name='Did you get the capabilities and features that you expected out of Rowsandall')

    fallshort = models.TextField(max_length=500,blank=True,verbose_name='Where did Rowsandall fall short of your expectations?')

    considerchoices = (
                       ('no','No'),
                       ('pro','Yes: Pro'),
                       ('plan','Yes: Self-Coach'),
                       ('coach','Yes: Coach')
    )

    considered = models.CharField(max_length=150,choices=considerchoices,default=None,null=True,blank=True,
                                  verbose_name='If you are on a Free plan, did you consider one of the paid plans?')

    features = models.TextField(max_length=500,blank=True,
                                verbose_name="What combination of features would entice you to upgrade to a paid plan")

    agreechoices = (
    ('completely_disagree','Completely Disagree'),
    ('disagree','Disagree'),
    ('neutral','Neither agree nor disagree'),
    ('agree','Agree'),
    ('completely_agree','Completely Agree'),
    )

    pricing = models.CharField(
    max_length=150,choices=agreechoices,default=None,null=True,blank=True,
    verbose_name="The pricing for plans is clear and understandable"
    )

    subscription = models.CharField(
    max_length=150,choices=agreechoices,default=None,null=True,blank=True,
    verbose_name="I feel like I get a good value for the price of the subscription"
    )

    advanced = models.CharField(
    max_length=150,choices=agreechoices,default=None,null=True,blank=True,
    verbose_name="I feel like the advanced features of Rowsandall are easy to use"
    )

    mobile = models.CharField(
    max_length=150,choices=agreechoices,default=None,null=True,blank=True,
    verbose_name="It is easy to use Rowsandall from a mobile device"
    )

    developer1 = models.CharField(
    max_length=150,choices=agreechoices,default=None,null=True,blank=True,
    verbose_name="I feel like the developer of Rowsandall is responsive to problems and resolves them quickly"
    )

    developer2 = models.CharField(
    max_length=150,choices=agreechoices,default=None,null=True,blank=True,
    verbose_name="I feel like the developer of Rowsandall is responsive to ideas for new features and capabilities"
    )

    sugchoices = (
                  ('bug','Resolve a bug'),
                  ('newfeature','Add a new feature'),
                  ('improve','Improve the ease of use of the site'),
                  ('easy','Make the site easier to use on mobile devices'),
                  ('other','Other')
    )

    bug = models.BooleanField(default=False,verbose_name='Resolve a bug')
    newfeature = models.BooleanField(default=False,verbose_name='Add a new feature')
    improve = models.BooleanField(default=False,verbose_name='Improve the ease of use of the site')
    easu = models.BooleanField(default=False,verbose_name='Make the site easier to use on mobile devices')
    other = models.BooleanField(default=False,verbose_name='Other')

    suggestiontext = models.TextField(
                                      max_length=500,default=None,null=True,blank=True,
                                      verbose_name='My suggestion is (please write a short description of your suggestion)'
                                      )
