# Generated by Django 2.2 on 2021-10-29 10:24

from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import stdimage.models
import stdimage.validators
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('QrcodeCashless', '0002_cartecashless_user'),
    ]

    operations = [
        migrations.CreateModel(
            name='Event',
            fields=[
                ('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
                ('name', models.CharField(max_length=200)),
                ('datetime', models.DateTimeField()),
                ('short_description', models.CharField(max_length=250)),
                ('long_description', models.TextField(blank=True, null=True)),
                ('img', stdimage.models.StdImageField(upload_to='images/', validators=[stdimage.validators.MaxSizeValidator(1920, 1920)])),
                ('reservations', models.PositiveSmallIntegerField(default=0)),
                ('categorie', models.CharField(choices=[('LIV', 'Concert'), ('FES', 'Festival'), ('REU', 'Réunion'), ('CON', 'Conférence')], default='LIV', max_length=3, verbose_name="Catégorie d'évènement")),
            ],
            options={
                'verbose_name': 'Evenement',
                'verbose_name_plural': 'Evenements',
                'ordering': ('datetime',),
            },
        ),
        migrations.CreateModel(
            name='OptionGenerale',
            fields=[
                ('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
                ('name', models.CharField(max_length=30)),
                ('poids', models.PositiveSmallIntegerField(default=0, verbose_name='Poids')),
            ],
            options={
                'verbose_name': 'Options Generales',
                'verbose_name_plural': 'Options Generales',
                'ordering': ('poids',),
            },
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
                ('name', models.CharField(max_length=50)),
                ('publish', models.BooleanField(default=False)),
                ('img', stdimage.models.StdImageField(blank=True, null=True, upload_to='images/', validators=[stdimage.validators.MaxSizeValidator(1920, 1920)], verbose_name='Image')),
                ('categorie_article', models.CharField(choices=[('B', 'Billet'), ('P', "Pack d'objets"), ('R', 'Recharge cashless'), ('T', 'Vetement'), ('M', 'Merchandasing'), ('A', 'Adhésion')], default='B', max_length=3, verbose_name="Type d'article")),
                ('id_product_stripe', models.CharField(blank=True, max_length=30, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Reservation',
            fields=[
                ('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
                ('datetime', models.DateTimeField(auto_now=True)),
                ('status', models.CharField(choices=[('C', 'Annulée'), ('N', 'Non payée'), ('P', 'Payée'), ('V', 'Validée')], default='N', max_length=3, verbose_name='Status de la réservation')),
                ('event', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='reservation', to='BaseBillet.Event')),
                ('options', models.ManyToManyField(blank=True, to='BaseBillet.OptionGenerale')),
                ('user_commande', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('-datetime',),
            },
        ),
        migrations.CreateModel(
            name='Ticket',
            fields=[
                ('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
                ('first_name', models.CharField(max_length=200)),
                ('last_name', models.CharField(max_length=200)),
                ('status', models.CharField(choices=[('N', 'Non actif'), ('K', 'Non scanné'), ('S', 'scanné')], default='N', max_length=1, verbose_name='Status du scan')),
                ('reservation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tickets', to='BaseBillet.Reservation')),
            ],
        ),
        migrations.CreateModel(
            name='Price',
            fields=[
                ('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
                ('name', models.CharField(max_length=50)),
                ('prix', models.FloatField()),
                ('vat', models.CharField(choices=[('NA', 'Non applicable'), ('DX', '10 %'), ('VG', '20 %')], default='NA', max_length=2, verbose_name='Taux TVA')),
                ('id_price_stripe', models.CharField(blank=True, max_length=30, null=True)),
                ('stock', models.SmallIntegerField(blank=True, null=True)),
                ('max_per_user', models.PositiveSmallIntegerField(default=10)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='prices', to='BaseBillet.Product')),
            ],
        ),
        migrations.CreateModel(
            name='Paiement_stripe',
            fields=[
                ('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
                ('detail', models.CharField(blank=True, max_length=50, null=True)),
                ('id_stripe', models.CharField(blank=True, max_length=80, null=True)),
                ('metadata_stripe', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)),
                ('order_date', models.DateTimeField(auto_now_add=True, verbose_name='Date')),
                ('last_action', models.DateTimeField(auto_now=True)),
                ('status', models.CharField(choices=[('N', 'Lien de paiement non créé'), ('O', 'Envoyée a Stripe'), ('W', 'En attente de paiement'), ('E', 'Expiré'), ('P', 'Payée'), ('V', 'Payée et validée'), ('C', 'Annulée')], default='N', max_length=1, verbose_name='Statut de la commande')),
                ('source', models.CharField(choices=[('Q', 'Depuis scan QR-Code'), ('B', 'Depuis billetterie')], default='B', max_length=1, verbose_name='Source de la commande')),
                ('total', models.FloatField(default=0)),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='LigneArticle',
            fields=[
                ('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, primary_key=True, serialize=False)),
                ('datetime', models.DateTimeField(auto_now=True)),
                ('qty', models.SmallIntegerField()),
                ('status', models.CharField(choices=[('C', 'Annulée'), ('N', 'Non payée'), ('P', 'Payée'), ('V', 'Validée par serveur cashless')], default='N', max_length=3, verbose_name='Status de ligne article')),
                ('carte', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='QrcodeCashless.CarteCashless')),
                ('paiement_stripe', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='BaseBillet.Paiement_stripe')),
                ('price', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='BaseBillet.Price')),
            ],
            options={
                'ordering': ('-datetime',),
            },
        ),
        migrations.AddField(
            model_name='event',
            name='products',
            field=models.ManyToManyField(blank=True, to='BaseBillet.Product'),
        ),
        migrations.CreateModel(
            name='Configuration',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('organisation', models.CharField(max_length=50, verbose_name="Nom de l'organisation")),
                ('short_description', models.CharField(max_length=250, verbose_name='Description courte')),
                ('adress', models.CharField(max_length=250)),
                ('phone', models.CharField(max_length=20)),
                ('email', models.EmailField(max_length=254)),
                ('site_web', models.URLField(blank=True, null=True)),
                ('twitter', models.URLField(blank=True, null=True)),
                ('facebook', models.URLField(blank=True, null=True)),
                ('instagram', models.URLField(blank=True, null=True)),
                ('adhesion_obligatoire', models.BooleanField(default=False)),
                ('name_required_for_ticket', models.BooleanField(default=False, verbose_name='Billet nominatifs')),
                ('carte_restaurant', stdimage.models.StdImageField(blank=True, null=True, upload_to='images/', validators=[stdimage.validators.MaxSizeValidator(1920, 1920)], verbose_name='Carte du restaurant')),
                ('img', stdimage.models.StdImageField(blank=True, null=True, upload_to='images/', verbose_name='Background')),
                ('mollie_api_key', models.CharField(blank=True, max_length=50, null=True)),
                ('stripe_api_key', models.CharField(blank=True, max_length=110, null=True)),
                ('stripe_test_api_key', models.CharField(blank=True, max_length=110, null=True)),
                ('stripe_mode_test', models.BooleanField(default=True)),
                ('activer_billetterie', models.BooleanField(default=True, verbose_name='Activer la billetterie')),
                ('jauge_max', models.PositiveSmallIntegerField(default=50, verbose_name='Jauge maximale')),
                ('server_cashless', models.URLField(blank=True, max_length=300, null=True, verbose_name='Adresse du serveur Cashless')),
                ('key_cashless', models.CharField(blank=True, max_length=41, null=True, verbose_name="Clé d'API du serveur cashless")),
                ('option_generale_checkbox', models.ManyToManyField(blank=True, related_name='checkbox', to='BaseBillet.OptionGenerale')),
                ('option_generale_radio', models.ManyToManyField(blank=True, related_name='radiobutton', to='BaseBillet.OptionGenerale')),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
