# Generated by Django 5.2.3 on 2025-07-06 18:09

import django.contrib.auth.models
import django.contrib.auth.validators
import django.core.validators
import django.db.models.deletion
import django.utils.timezone
import uuid
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='Role',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Date and time when the record was created', verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Date and time when the record was last updated', verbose_name='Updated At')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Unique identifier for this record', primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False, help_text='Whether this record has been soft deleted', verbose_name='Is Deleted')),
                ('deleted_at', models.DateTimeField(blank=True, help_text='Date and time when the record was deleted', null=True, verbose_name='Deleted At')),
                ('name', models.CharField(help_text='Unique name for the role', max_length=100, unique=True, verbose_name='Role Name')),
                ('description', models.TextField(blank=True, help_text='Detailed description of the role', verbose_name='Description')),
                ('is_active', models.BooleanField(default=True, help_text='Whether this role is currently active', verbose_name='Is Active')),
                ('priority', models.PositiveIntegerField(default=0, help_text='Higher number means higher priority', verbose_name='Priority')),
                ('permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this role', to='auth.permission', verbose_name='Permissions')),
            ],
            options={
                'verbose_name': 'Role',
                'verbose_name_plural': 'Roles',
                'db_table': 'accounts_role',
                'ordering': ['-priority', 'name'],
            },
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('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')),
                ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
                ('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')),
                ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Date and time when the record was created', verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Date and time when the record was last updated', verbose_name='Updated At')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Unique identifier for this record', primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False, help_text='Whether this record has been soft deleted', verbose_name='Is Deleted')),
                ('deleted_at', models.DateTimeField(blank=True, help_text='Date and time when the record was deleted', null=True, verbose_name='Deleted At')),
                ('email', models.EmailField(help_text="User's email address - used for login", max_length=254, unique=True, verbose_name='Email Address')),
                ('phone_number', models.CharField(blank=True, help_text="User's phone number", max_length=17, null=True, validators=[django.core.validators.RegexValidator(message="Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.", regex='^\\+?1?\\d{9,15}$')], verbose_name='Phone Number')),
                ('is_verified', models.BooleanField(default=False, help_text="Whether the user's email is verified", verbose_name='Is Verified')),
                ('last_login_ip', models.GenericIPAddressField(blank=True, help_text='IP address of last login', null=True, verbose_name='Last Login IP')),
                ('email_verified_at', models.DateTimeField(blank=True, help_text='When the email was verified', null=True, verbose_name='Email Verified At')),
                ('created_by', models.ForeignKey(blank=True, help_text='User who created this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_records', to='accounts.user')),
                ('deleted_by', models.ForeignKey(blank=True, help_text='User who deleted this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_deleted_records', to='accounts.user')),
                ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to.', related_name='custom_user_set', related_query_name='custom_user', to='auth.group', verbose_name='groups')),
                ('roles', models.ManyToManyField(blank=True, help_text='Roles assigned to this user', to='accounts.role', verbose_name='User Roles')),
                ('updated_by', models.ForeignKey(blank=True, help_text='User who last updated this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_records', to='accounts.user')),
                ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='custom_user_set', related_query_name='custom_user', to='auth.permission', verbose_name='user permissions')),
            ],
            options={
                'verbose_name': 'User',
                'verbose_name_plural': 'Users',
                'db_table': 'accounts_user',
                'ordering': ['-date_joined'],
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.AddField(
            model_name='role',
            name='created_by',
            field=models.ForeignKey(blank=True, help_text='User who created this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_records', to='accounts.user'),
        ),
        migrations.AddField(
            model_name='role',
            name='deleted_by',
            field=models.ForeignKey(blank=True, help_text='User who deleted this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_deleted_records', to='accounts.user'),
        ),
        migrations.AddField(
            model_name='role',
            name='updated_by',
            field=models.ForeignKey(blank=True, help_text='User who last updated this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_records', to='accounts.user'),
        ),
        migrations.CreateModel(
            name='Profile',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Date and time when the record was created', verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Date and time when the record was last updated', verbose_name='Updated At')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Unique identifier for this record', primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False, help_text='Whether this record has been soft deleted', verbose_name='Is Deleted')),
                ('deleted_at', models.DateTimeField(blank=True, help_text='Date and time when the record was deleted', null=True, verbose_name='Deleted At')),
                ('job_title', models.CharField(blank=True, help_text='User job title or position', max_length=100, verbose_name='Job Title')),
                ('bio', models.TextField(blank=True, help_text="User's biography or description", max_length=500, verbose_name='Biography')),
                ('avatar', models.ImageField(blank=True, help_text="User's profile picture", null=True, upload_to='avatars/%Y/%m/', verbose_name='Avatar')),
                ('birth_date', models.DateField(blank=True, help_text="User's birth date", null=True, verbose_name='Birth Date')),
                ('company', models.CharField(blank=True, help_text='User company or organization', max_length=100, verbose_name='Company')),
                ('department', models.CharField(blank=True, help_text='User department within the company', max_length=100, verbose_name='Department')),
                ('website', models.URLField(blank=True, help_text="User's website URL", verbose_name='Website')),
                ('address_line1', models.CharField(blank=True, help_text='Street address', max_length=255, verbose_name='Address Line 1')),
                ('address_line2', models.CharField(blank=True, help_text='Apartment, suite, etc.', max_length=255, verbose_name='Address Line 2')),
                ('city', models.CharField(blank=True, help_text='City', max_length=100, verbose_name='City')),
                ('state', models.CharField(blank=True, help_text='State or province', max_length=100, verbose_name='State/Province')),
                ('postal_code', models.CharField(blank=True, help_text='ZIP or postal code', max_length=20, verbose_name='Postal Code')),
                ('country', models.CharField(blank=True, help_text='Country', max_length=100, verbose_name='Country')),
                ('is_profile_public', models.BooleanField(default=True, help_text='Whether the profile is publicly visible', verbose_name='Public Profile')),
                ('email_notifications', models.BooleanField(default=True, help_text='Receive email notifications', verbose_name='Email Notifications')),
                ('sms_notifications', models.BooleanField(default=False, help_text='Receive SMS notifications', verbose_name='SMS Notifications')),
                ('created_by', models.ForeignKey(blank=True, help_text='User who created this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_records', to='accounts.user')),
                ('deleted_by', models.ForeignKey(blank=True, help_text='User who deleted this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_deleted_records', to='accounts.user')),
                ('updated_by', models.ForeignKey(blank=True, help_text='User who last updated this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_records', to='accounts.user')),
                ('user', models.OneToOneField(help_text='Associated user account', on_delete=django.db.models.deletion.CASCADE, related_name='profile', to='accounts.user', verbose_name='User')),
            ],
            options={
                'verbose_name': 'User Profile',
                'verbose_name_plural': 'User Profiles',
                'db_table': 'accounts_profile',
                'ordering': ['-created_at'],
            },
        ),
        migrations.AddIndex(
            model_name='user',
            index=models.Index(fields=['email'], name='accounts_us_email_74c8d6_idx'),
        ),
        migrations.AddIndex(
            model_name='user',
            index=models.Index(fields=['is_active', 'is_verified'], name='accounts_us_is_acti_0584df_idx'),
        ),
        migrations.AddIndex(
            model_name='user',
            index=models.Index(fields=['date_joined'], name='accounts_us_date_jo_ff39bb_idx'),
        ),
    ]
