# Generated by Django 3.1 on 2022-02-04 00:30

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('email', models.EmailField(max_length=255, unique=True)),
                ('nom', models.CharField(max_length=255)),
                ('prenom', models.CharField(blank=True, max_length=255)),
                ('phone', models.CharField(max_length=255, unique=True)),
                ('Pays', models.CharField(blank=True, max_length=255, null=True)),
                ('avatar', models.ImageField(blank=True, null=True, upload_to='images/%Y/%m/%d')),
                ('Type', models.CharField(choices=[('lecteur', 'Lecteur'), ('auteur', 'Auteur'), ('visiteur', 'Visiteur'), ('admin', 'Admin')], max_length=25)),
                ('is_active', models.BooleanField(default=True)),
                ('is_staff', models.BooleanField(default=False)),
                ('abonnements', models.ManyToManyField(blank=True, related_name='abonnement', to=settings.AUTH_USER_MODEL)),
                ('abonnes', models.ManyToManyField(blank=True, related_name='abonne', to=settings.AUTH_USER_MODEL)),
                ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
                ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Categorie',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nom', models.CharField(choices=[('actualité', 'Actualité'), ('affaire', 'Affaire'), ('sport et loisir', 'Sport et Loisir')], max_length=25, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Commentaire',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(default=django.utils.timezone.now)),
                ('texte', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='Document',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('titre', models.CharField(default='NAN', max_length=255)),
                ('descriptions', models.TextField(blank=True)),
                ('date', models.DateTimeField(default=django.utils.timezone.now)),
                ('contenu', models.TextField(blank=True)),
                ('tags', models.CharField(blank=True, max_length=300)),
                ('Type', models.CharField(choices=[('ArtMag', 'magazine/journal'), ('livre', 'Livre')], max_length=25)),
                ('auteur', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('categorie', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='rest_api.categorie')),
                ('commentaires', models.ManyToManyField(blank=True, related_name='comment_doc', to='rest_api.Commentaire')),
                ('lecteurs', models.ManyToManyField(blank=True, related_name='lecteurs', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Like',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(default=django.utils.timezone.now)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='like_user', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Repost',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(default=django.utils.timezone.now)),
                ('articlemagazine', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='articlerepost', to='rest_api.document')),
                ('commentaires', models.ManyToManyField(related_name='commentRepost', to='rest_api.Commentaire')),
                ('likes', models.ManyToManyField(related_name='likesrepost', to='rest_api.Like')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='userrepost', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Lecture',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(auto_now=True)),
                ('document', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='doclecture', to='rest_api.document')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='userlecture', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='document',
            name='likes',
            field=models.ManyToManyField(blank=True, related_name='like_doc', to='rest_api.Like'),
        ),
        migrations.AddField(
            model_name='document',
            name='repost',
            field=models.ManyToManyField(blank=True, related_name='repost_doc', to='rest_api.Repost'),
        ),
        migrations.AddField(
            model_name='commentaire',
            name='likes',
            field=models.ManyToManyField(blank=True, related_name='like_reponses', to='rest_api.Like'),
        ),
        migrations.AddField(
            model_name='commentaire',
            name='reponses',
            field=models.ManyToManyField(blank=True, related_name='reponse', to='rest_api.Commentaire'),
        ),
        migrations.AddField(
            model_name='commentaire',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comment_user', to=settings.AUTH_USER_MODEL),
        ),
    ]
