# Path: apps/account/models.py
# class Account(Model):
# 
#     # main data
#     user = ForeignKey('auth.User', unique=True, related_name="accounts")
#     description = TextField(blank=True)
#     source = CharField(max_length=64, choices=SOURCE_CHOICES, default='OTHER')
#     mobile = CharField(max_length=1024, blank=True)
#     links = ManyToManyField('link.Link', null=True, blank=True) 
#     passport = ProcessedImageField(upload_to=_upload_to, null=True, blank=True, 
#                                    processors=[ResizeToFit(1024, 768)],
#                                    format='JPEG', options={'quality': 90})
# 
#     # meta
#     # created_by = self
#     # updated_by = self
#     created_on = DateTimeField(auto_now_add=True)
#     updated_on = DateTimeField(auto_now=True)
# 
#     def get_name():
#         return self.user.username
# 
#     def __unicode__(self):
#         return self.user.username
# 
#     class Meta:
# 
#         ordering = ['user__username']


from django.db.models import Model
from django.db.models import ForeignKey
from django.db.models import BooleanField
from django.db.models import CharField
from django.db.models import TextField
from django.db.models import DateTimeField
from django.utils.translation import ugettext as _
from apps.account.models import Account
# Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com>                  
# License: MIT (see LICENSE.TXT file) 




SIZE_CHOICES = [      # Body Hight
    ('SMALL', _('SMALL')),  # 0cm - 145cm
    ('MEDIUM', _('MEDIUM')), # 145cm - 175cm
    ('LARGE', _('LARGE'))   # 175cm + 
]


class Bike(Model):

    # main data
    team = ForeignKey('team.Team', related_name='bikes')
    name = CharField(max_length=1024)
    gallery = ForeignKey('gallery.Gallery')
    description = TextField()
    active = BooleanField(default=True)
    reserve = BooleanField(default=False) # not requestable
    station = ForeignKey('station.Station', related_name="bikes")
    lockcode = CharField(max_length=1024)
    size = CharField(max_length=64, choices=SIZE_CHOICES, default='MEDIUM')
    lights = BooleanField(default=False) # to cycle when dark
    
    # metadata
    created_by  = ForeignKey(Account, related_name="bikes_created")
    created_on  = DateTimeField(auto_now_add=True)

# Path: apps/account/models.py
# class Account(Model):
# 
#     # main data
#     user = ForeignKey('auth.User', unique=True, related_name="accounts")
#     description = TextField(blank=True)
#     source = CharField(max_length=64, choices=SOURCE_CHOICES, default='OTHER')
#     mobile = CharField(max_length=1024, blank=True)
#     links = ManyToManyField('link.Link', null=True, blank=True) 
#     passport = ProcessedImageField(upload_to=_upload_to, null=True, blank=True, 
#                                    processors=[ResizeToFit(1024, 768)],
#                                    format='JPEG', options={'quality': 90})
# 
#     # meta
#     # created_by = self
#     # updated_by = self
#     created_on = DateTimeField(auto_now_add=True)
#     updated_on = DateTimeField(auto_now=True)
# 
#     def get_name():
#         return self.user.username
# 
#     def __unicode__(self):
#         return self.user.username
# 
#     class Meta:
# 
#         ordering = ['user__username']


# Path: apps/bike/models.py
from django.db.models import Model
from django.db.models import ForeignKey
from django.db.models import BooleanField
from django.db.models import CharField
from django.db.models import TextField
from django.db.models import DateTimeField
from django.utils.translation import ugettext as _
from apps.account.models import Account

# Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com>                  
# License: MIT (see LICENSE.TXT file) 




SIZE_CHOICES = [      # Body Hight
    ('SMALL', _('SMALL')),  # 0cm - 145cm
    ('MEDIUM', _('MEDIUM')), # 145cm - 175cm
    ('LARGE', _('LARGE'))   # 175cm + 
]


class Bike(Model):

    # main data
    team = ForeignKey('team.Team', related_name='bikes')
    name = CharField(max_length=1024)
    gallery = ForeignKey('gallery.Gallery')
    description = TextField()
    active = BooleanField(default=True)
    reserve = BooleanField(default=False) # not requestable
    station = ForeignKey('station.Station', related_name="bikes")
    lockcode = CharField(max_length=1024)
    size = CharField(max_length=64, choices=SIZE_CHOICES, default='MEDIUM')
    lights = BooleanField(default=False) # to cycle when dark
    
    # metadata
    created_by  = ForeignKey(Account, related_name="bikes_created")
    created_on  = DateTimeField(auto_now_add=True)

    updated_by  = ForeignKey(Account, related_name="bikes_updated")