# Generated by Django 5.0.2 on 2024-02-11 19:08

import django.contrib.auth.validators
import django.db.models.deletion
import django.utils.timezone
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='IAmAppAction',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('label', models.CharField(blank=True, max_length=255, null=True)),
                ('slug', models.SlugField(blank=True, max_length=255, null=True)),
                ('sort_order', models.IntegerField(blank=True, null=True)),
                ('small_image_url', models.ImageField(blank=True, null=True, upload_to='')),
                ('large_image_url', models.ImageField(blank=True, null=True, upload_to='')),
                ('active', models.BooleanField(default=True)),
                ('deleted', models.BooleanField(default=False)),
                ('created_by', models.SmallIntegerField(blank=True, null=True)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('modified_by', models.SmallIntegerField(blank=True, null=True)),
                ('modified_on', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'iam_app_action',
            },
        ),
        migrations.CreateModel(
            name='IAmAppResource',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('label', models.CharField(blank=True, max_length=255, null=True)),
                ('slug', models.SlugField(blank=True, max_length=255, null=True)),
                ('sort_order', models.IntegerField(blank=True, null=True)),
                ('small_image_url', models.ImageField(blank=True, null=True, upload_to='')),
                ('large_image_url', models.ImageField(blank=True, null=True, upload_to='')),
                ('active', models.BooleanField(default=True)),
                ('deleted', models.BooleanField(default=False)),
                ('created_by', models.SmallIntegerField(blank=True, null=True)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('modified_by', models.SmallIntegerField(blank=True, null=True)),
                ('modified_on', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'iam_app_resource',
            },
        ),
        migrations.CreateModel(
            name='IAmPrincipalGroup',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('label', models.CharField(blank=True, max_length=255, null=True)),
                ('slug', models.SlugField(blank=True, max_length=255, null=True)),
                ('sort_order', models.IntegerField(blank=True, null=True)),
                ('small_image_url', models.ImageField(blank=True, null=True, upload_to='')),
                ('large_image_url', models.ImageField(blank=True, null=True, upload_to='')),
                ('active', models.BooleanField(default=True)),
                ('deleted', models.BooleanField(default=False)),
                ('created_by', models.SmallIntegerField(blank=True, null=True)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('modified_by', models.SmallIntegerField(blank=True, null=True)),
                ('modified_on', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'iam_principal_group',
            },
        ),
        migrations.CreateModel(
            name='IAmPrincipalSource',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('label', models.CharField(blank=True, max_length=255, null=True)),
                ('slug', models.SlugField(blank=True, max_length=255, null=True)),
                ('sort_order', models.IntegerField(blank=True, null=True)),
                ('small_image_url', models.ImageField(blank=True, null=True, upload_to='')),
                ('large_image_url', models.ImageField(blank=True, null=True, upload_to='')),
                ('active', models.BooleanField(default=True)),
                ('deleted', models.BooleanField(default=False)),
                ('created_by', models.SmallIntegerField(blank=True, null=True)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('modified_by', models.SmallIntegerField(blank=True, null=True)),
                ('modified_on', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'iam_principal_source',
            },
        ),
        migrations.CreateModel(
            name='IAmPrincipalType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('label', models.CharField(blank=True, max_length=255, null=True)),
                ('slug', models.SlugField(blank=True, max_length=255, null=True)),
                ('sort_order', models.IntegerField(blank=True, null=True)),
                ('small_image_url', models.ImageField(blank=True, null=True, upload_to='')),
                ('large_image_url', models.ImageField(blank=True, null=True, upload_to='')),
                ('active', models.BooleanField(default=True)),
                ('deleted', models.BooleanField(default=False)),
                ('created_by', models.SmallIntegerField(blank=True, null=True)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('modified_by', models.SmallIntegerField(blank=True, null=True)),
                ('modified_on', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'iam_principal_type',
            },
        ),
        migrations.CreateModel(
            name='IAmRole',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('label', models.CharField(blank=True, max_length=255, null=True)),
                ('slug', models.SlugField(blank=True, max_length=255, null=True)),
                ('sort_order', models.IntegerField(blank=True, null=True)),
                ('small_image_url', models.ImageField(blank=True, null=True, upload_to='')),
                ('large_image_url', models.ImageField(blank=True, null=True, upload_to='')),
                ('active', models.BooleanField(default=True)),
                ('deleted', models.BooleanField(default=False)),
                ('created_by', models.SmallIntegerField(blank=True, null=True)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('modified_by', models.SmallIntegerField(blank=True, null=True)),
                ('modified_on', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'iam_role',
            },
        ),
        migrations.CreateModel(
            name='IAmPrincipal',
            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')),
                ('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')),
                ('email', models.EmailField(max_length=254, unique=True)),
                ('gender', models.CharField(blank=True, max_length=5, null=True)),
                ('date_of_birth', models.DateField(blank=True, null=True)),
                ('phone_no', models.IntegerField()),
                ('address_line1', models.TextField(blank=True, null=True)),
                ('address_line2', models.TextField(blank=True, null=True)),
                ('city', models.CharField(blank=True, max_length=100, null=True)),
                ('state', models.CharField(blank=True, max_length=100, null=True)),
                ('country', models.CharField(blank=True, max_length=100, null=True)),
                ('post_code', models.CharField(blank=True, max_length=100, null=True)),
                ('profile_photo', models.ImageField(blank=True, null=True, upload_to='profile')),
                ('phone_verified', models.BooleanField(default=False)),
                ('email_verified', models.BooleanField(default=False)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('modified_on', models.DateTimeField(auto_now=True)),
                ('deleted', models.BooleanField(default=False)),
                ('register_complete', models.BooleanField(default=False)),
                ('player_id', models.CharField(blank=True, help_text='OneSignal player id for push notification', max_length=255, null=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='creations', 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')),
                ('modified_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='modifications', to=settings.AUTH_USER_MODEL)),
                ('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={
                'db_table': 'iam_principal',
            },
        ),
        migrations.CreateModel(
            name='IAmAppResourceActionLink',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('app_action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='resource_action_link_app_action', to='module_iam.iamappaction')),
                ('app_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='resource_action_link_app_resource', to='module_iam.iamappresource')),
            ],
            options={
                'db_table': 'iam_app_resource_action_link',
            },
        ),
        migrations.AddField(
            model_name='iamappresource',
            name='action',
            field=models.ManyToManyField(related_name='app_resource_action', through='module_iam.IAmAppResourceActionLink', to='module_iam.iamappaction'),
        ),
        migrations.CreateModel(
            name='IAmPrincipalBiometric',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('active', models.BooleanField(default=True)),
                ('deleted', models.BooleanField(default=False)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('modified_on', models.DateTimeField(auto_now=True)),
                ('biometric_type', models.CharField(max_length=100)),
                ('biometric_data', models.CharField(max_length=255)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_created', to=settings.AUTH_USER_MODEL)),
                ('modified_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_modified', to=settings.AUTH_USER_MODEL)),
                ('principal', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='principal_biometric', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'iam_principal_biometric',
            },
        ),
        migrations.CreateModel(
            name='IAmPricipalGroupRoleLink',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('principal_group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='role_link_principal_group', to='module_iam.iamprincipalgroup')),
                ('role', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='role_link_role', to='module_iam.iamrole')),
            ],
            options={
                'db_table': 'iam_principal_group_role_link',
            },
        ),
        migrations.CreateModel(
            name='IAmPrincipalGroupLink',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('principal', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='principal_group_link_principal', to=settings.AUTH_USER_MODEL)),
                ('principal_group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='principal_group_link_group', to='module_iam.iamprincipalgroup')),
            ],
            options={
                'db_table': 'iam_principal_principal_group_link',
            },
        ),
        migrations.AddField(
            model_name='iamprincipal',
            name='principal_group',
            field=models.ManyToManyField(related_name='principal_groups', through='module_iam.IAmPrincipalGroupLink', to='module_iam.iamprincipalgroup'),
        ),
        migrations.CreateModel(
            name='IAmPrincipalOtp',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('otp_code', models.CharField(max_length=4)),
                ('otp_purpose', models.CharField(blank=True, max_length=50, null=True)),
                ('valid_till', models.DateTimeField()),
                ('is_used', models.BooleanField(default=False)),
                ('principal', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='principal_otp', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'iam_principal_otp',
            },
        ),
        migrations.AddField(
            model_name='iamprincipal',
            name='principal_source',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='principals_source', to='module_iam.iamprincipalsource'),
        ),
        migrations.AddField(
            model_name='iamprincipal',
            name='principal_type',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='principals_type', to='module_iam.iamprincipaltype'),
        ),
        migrations.AddField(
            model_name='iamprincipalgroup',
            name='role',
            field=models.ManyToManyField(related_name='principal_group_role', through='module_iam.IAmPricipalGroupRoleLink', to='module_iam.iamrole'),
        ),
        migrations.CreateModel(
            name='IAmRoleAppResourceActionLink',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('app_resource_action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='role_app_resource_action_link_app_resource_action', to='module_iam.iamappresourceactionlink')),
                ('role', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='role_app_resource_action_link_role', to='module_iam.iamrole')),
            ],
            options={
                'db_table': 'iam_role_app_resource_action_link',
            },
        ),
        migrations.AddField(
            model_name='iamrole',
            name='app_resource_action',
            field=models.ManyToManyField(related_name='role_app_resource_action', through='module_iam.IAmRoleAppResourceActionLink', to='module_iam.iamappresourceactionlink'),
        ),
    ]
