# Generated by Django 5.2.12 on 2026-08-28 13:11

import Userauths.models
import django.contrib.auth.models
import django.db.models.deletion
import django.utils.timezone
import shortuuid.django_fields
import simple_history.models
import uuid
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='LocalEntrepot',
            fields=[
                ('code', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('nom', models.CharField(max_length=100)),
                ('latitude', models.DecimalField(blank=True, decimal_places=7, help_text='Latitude GPS (ex: 5.345317 pour Abidjan-Plateau)', max_digits=9, null=True)),
                ('longitude', models.DecimalField(blank=True, decimal_places=7, help_text='Longitude GPS (ex: -4.024429 pour Abidjan-Plateau)', max_digits=9, null=True)),
                ('statut', models.BooleanField(default=True, help_text='Coché = Ouvert, décoché = Fermé', verbose_name='Statut')),
            ],
        ),
        migrations.CreateModel(
            name='TypeCustomPermission',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cid', shortuuid.django_fields.ShortUUIDField(alphabet='abcd1234', editable=False, length=6, max_length=6, prefix='', unique=True)),
                ('categorie', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='CustomUser',
            fields=[
                ('id', models.BigAutoField(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')),
                ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('email', models.EmailField(max_length=254, unique=True)),
                ('username', models.CharField(max_length=100, unique=True)),
                ('contact', models.CharField(blank=True, max_length=15)),
                ('role', models.CharField(choices=[('accueil', 'Service Accueil'), ('caissier', 'Caissier(ère)'), ('livreur', 'Livreur(euse)'), ('chefagence', 'Chef agence'), ('gestionnaire', 'Gestionnaire'), ('admin', 'Administrateur'), ('client', 'Client')], default='caissier', max_length=20)),
                ('genre', models.CharField(choices=[('Homme', 'Homme'), ('Femme', 'Femme')], default='Homme', max_length=20)),
                ('is_active', models.BooleanField(default=True)),
                ('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')),
                ('local_entrepot', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='local_entrepot_users', to='Userauths.localentrepot')),
                ('user_permissions', models.ManyToManyField(blank=True, related_name='customuser_permissions', to='auth.permission')),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='PWD_FORGET',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('otp', models.IntegerField()),
                ('status', models.CharField(default='0', max_length=1)),
                ('purpose', models.CharField(choices=[('password_reset', 'Réinitialisation mot de passe'), ('activation', 'Activation compte')], db_index=True, default='password_reset', max_length=32)),
                ('creat_at', models.DateTimeField(auto_now_add=True)),
                ('user_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ProfilUser',
            fields=[
                ('pid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('photo', models.ImageField(blank=True, default='profils/default/avatar.png', null=True, upload_to=Userauths.models.profil_image_upload_path)),
                ('date_naissance', models.DateField(blank=True, null=True)),
                ('adresse', models.CharField(blank=True, max_length=255, null=True)),
                ('ville', models.CharField(blank=True, max_length=100, null=True)),
                ('pays', models.CharField(default="Côte d'Ivoire", max_length=100)),
                ('code_postal', models.CharField(blank=True, max_length=20, null=True)),
                ('poste', models.CharField(blank=True, max_length=100, null=True)),
                ('numero_employe', shortuuid.django_fields.ShortUUIDField(alphabet=None, blank=True, length=8, max_length=20, null=True, prefix='EMP&B-', unique=True)),
                ('date_embauche', models.DateField(blank=True, null=True)),
                ('statut', models.CharField(choices=[('actif', 'Actif'), ('inactif', 'Inactif'), ('suspendu', 'Suspendu')], default='actif', max_length=20)),
                ('bio', models.TextField(blank=True, max_length=500, null=True)),
                ('derniere_connexion', models.DateTimeField(blank=True, null=True)),
                ('est_verifie', models.BooleanField(default=False)),
                ('date_creation', models.DateTimeField(auto_now_add=True)),
                ('date_modification', models.DateTimeField(auto_now=True)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profil', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Profil Utilisateur',
                'verbose_name_plural': 'Profils Utilisateurs',
                'ordering': ['-date_creation'],
            },
        ),
        migrations.CreateModel(
            name='HistoricalProfilUser',
            fields=[
                ('pid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False)),
                ('photo', models.TextField(blank=True, default='profils/default/avatar.png', max_length=100, null=True)),
                ('date_naissance', models.DateField(blank=True, null=True)),
                ('adresse', models.CharField(blank=True, max_length=255, null=True)),
                ('ville', models.CharField(blank=True, max_length=100, null=True)),
                ('pays', models.CharField(default="Côte d'Ivoire", max_length=100)),
                ('code_postal', models.CharField(blank=True, max_length=20, null=True)),
                ('poste', models.CharField(blank=True, max_length=100, null=True)),
                ('numero_employe', shortuuid.django_fields.ShortUUIDField(alphabet=None, blank=True, db_index=True, length=8, max_length=20, null=True, prefix='EMP&B-')),
                ('date_embauche', models.DateField(blank=True, null=True)),
                ('statut', models.CharField(choices=[('actif', 'Actif'), ('inactif', 'Inactif'), ('suspendu', 'Suspendu')], default='actif', max_length=20)),
                ('bio', models.TextField(blank=True, max_length=500, null=True)),
                ('derniere_connexion', models.DateTimeField(blank=True, null=True)),
                ('est_verifie', models.BooleanField(default=False)),
                ('date_creation', models.DateTimeField(blank=True, editable=False)),
                ('date_modification', models.DateTimeField(blank=True, editable=False)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField(db_index=True)),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('user', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'historical Profil Utilisateur',
                'verbose_name_plural': 'historical Profils Utilisateurs',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': ('history_date', 'history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalCustomUser',
            fields=[
                ('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, 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')),
                ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('email', models.EmailField(db_index=True, max_length=254)),
                ('username', models.CharField(db_index=True, max_length=100)),
                ('contact', models.CharField(blank=True, max_length=15)),
                ('role', models.CharField(choices=[('accueil', 'Service Accueil'), ('caissier', 'Caissier(ère)'), ('livreur', 'Livreur(euse)'), ('chefagence', 'Chef agence'), ('gestionnaire', 'Gestionnaire'), ('admin', 'Administrateur'), ('client', 'Client')], default='caissier', max_length=20)),
                ('genre', models.CharField(choices=[('Homme', 'Homme'), ('Femme', 'Femme')], default='Homme', max_length=20)),
                ('is_active', models.BooleanField(default=True)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField(db_index=True)),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('local_entrepot', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='Userauths.localentrepot')),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'historical user',
                'verbose_name_plural': 'historical users',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': ('history_date', 'history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='EmailVerificationToken',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('token', models.CharField(editable=False, max_length=64, unique=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('used', models.BooleanField(default=False)),
                ('used_at', models.DateTimeField(blank=True, null=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='verification_tokens', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='CustomPermission',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('url', models.CharField(max_length=255)),
                ('categorie', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cat_permis', to='Userauths.typecustompermission')),
                ('users', models.ManyToManyField(blank=True, related_name='custom_permissions', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='CreneauDisponibilite',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('jour', models.PositiveSmallIntegerField(choices=[(0, 'Lundi'), (1, 'Mardi'), (2, 'Mercredi'), (3, 'Jeudi'), (4, 'Vendredi'), (5, 'Samedi'), (6, 'Dimanche')])),
                ('heure_ouverture', models.TimeField()),
                ('heure_fermeture', models.TimeField()),
                ('local_entrepot', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='creneaux', to='Userauths.localentrepot')),
            ],
            options={
                'verbose_name': 'Créneau de disponibilité',
                'verbose_name_plural': 'Créneaux de disponibilité',
                'ordering': ['jour', 'heure_ouverture'],
                'constraints': [models.UniqueConstraint(fields=('local_entrepot', 'jour'), name='uniq_creneau_local_jour')],
            },
        ),
    ]
