# Path: RandoAmisSecours/settings.py
# LANGUAGES = (
#     ('es', ugettext_lazy('Spanish')),
#     ('en', ugettext_lazy('English')),
#     ('fr', ugettext_lazy('French')),
# )


from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.timezone import datetime, utc
from django.utils.translation import ugettext_noop as _
from django.utils.translation import ugettext
from RandoAmisSecours.settings import LANGUAGES
import binascii
import json
import pytz
import os
CANCELED = 5
OUTING_STATUS = (
    (DRAFT, _('draft')),
    (CONFIRMED, _('confirmed')),
    (LATE, _('late')),
    (FINISHED, _('finished')),
    (CANCELED, _('canceled'))
)

PROVIDERS = (
    ('mobile.free.fr', 'Free Mobile France'),
)


def random_hash():
    """ Create a random string of size 30 """
    return binascii.b2a_hex(os.urandom(15))


@python_2_unicode_compatible
class Profile(models.Model):
    class Meta:
        app_label = 'RandoAmisSecours'

    user = models.OneToOneField(User)
    friends = models.ManyToManyField('self', blank=True)
    phone_number = models.CharField(max_length=30, blank=True, null=True)
    provider = models.CharField(max_length=30, blank=True, null=True, choices=PROVIDERS)
    provider_data = models.TextField(blank=True, null=True)
    hash_id = models.CharField(unique=True, max_length=30, default=random_hash)

# Path: RandoAmisSecours/settings.py
# LANGUAGES = (
#     ('es', ugettext_lazy('Spanish')),
#     ('en', ugettext_lazy('English')),
#     ('fr', ugettext_lazy('French')),
# )


# Path: RandoAmisSecours/models.py
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.timezone import datetime, utc
from django.utils.translation import ugettext_noop as _
from django.utils.translation import ugettext
from RandoAmisSecours.settings import LANGUAGES
import binascii
import json
import pytz
import os

CANCELED = 5
OUTING_STATUS = (
    (DRAFT, _('draft')),
    (CONFIRMED, _('confirmed')),
    (LATE, _('late')),
    (FINISHED, _('finished')),
    (CANCELED, _('canceled'))
)

PROVIDERS = (
    ('mobile.free.fr', 'Free Mobile France'),
)


def random_hash():
    """ Create a random string of size 30 """
    return binascii.b2a_hex(os.urandom(15))


@python_2_unicode_compatible
class Profile(models.Model):
    class Meta:
        app_label = 'RandoAmisSecours'

    user = models.OneToOneField(User)
    friends = models.ManyToManyField('self', blank=True)
    phone_number = models.CharField(max_length=30, blank=True, null=True)
    provider = models.CharField(max_length=30, blank=True, null=True, choices=PROVIDERS)
    provider_data = models.TextField(blank=True, null=True)
    hash_id = models.CharField(unique=True, max_length=30, default=random_hash)

    language = models.CharField(max_length=4, blank=True, null=True, choices=LANGUAGES)