# Generated by Django 5.1.4 on 2025-01-15 15:10

import django.db.models.deletion
import shared_models.common.utils
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Customer',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.CharField(blank=True, max_length=255, null=True)),
                ('updated_by', models.CharField(blank=True, max_length=255, null=True)),
                ('id', models.AutoField(editable=False, primary_key=True, serialize=False)),
                ('email', models.EmailField(max_length=254, unique=True, verbose_name='email address')),
                ('first_name', models.CharField(blank=True, max_length=150)),
                ('last_name', models.CharField(blank=True, max_length=150)),
                ('phone', models.CharField(blank=True, max_length=20)),
                ('mobile', models.CharField(blank=True, max_length=20)),
                ('country', models.CharField(blank=True, max_length=20)),
                ('nationality', models.CharField(blank=True, max_length=2)),
                ('source', models.CharField(blank=True, max_length=20)),
                ('agreement_id', models.CharField(blank=True, max_length=100)),
                ('is_funded', models.BooleanField(default=False)),
                ('first_deposit', models.DateTimeField(null=True)),
                ('is_individual', models.BooleanField(default=True)),
                ('is_lead', models.BooleanField(default=False)),
                ('is_client', models.BooleanField(default=False)),
                ('is_ib', models.BooleanField(default=False)),
                ('is_real', models.BooleanField(default=False)),
                ('is_live', models.BooleanField(default=False)),
                ('is_corporate', models.BooleanField(default=False)),
                ('submit_individual_form', models.BooleanField(default=False)),
                ('submit_corporate_form', models.BooleanField(default=False)),
                ('submit_ib_form', models.BooleanField(default=False)),
                ('kyc_status', models.CharField(choices=[('not_uploaded', 'Not Uploaded'), ('pending', 'Pending'), ('approved', 'Approved'), ('rejected', 'Rejected'), ('recheck_pending', 'Recheck Pending')], default='not_uploaded', max_length=20)),
                ('level_one_kyc_status', models.CharField(choices=[('not_uploaded', 'Not Uploaded'), ('pending', 'Pending'), ('approved', 'Approved'), ('rejected', 'Rejected'), ('recheck_pending', 'Recheck Pending')], default='not_uploaded', max_length=20)),
                ('level_two_kyc_status', models.CharField(choices=[('not_uploaded', 'Not Uploaded'), ('pending', 'Pending'), ('approved', 'Approved'), ('rejected', 'Rejected'), ('recheck_pending', 'Recheck Pending')], default='not_uploaded', max_length=20)),
                ('level_three_kyc_status', models.CharField(choices=[('not_uploaded', 'Not Uploaded'), ('pending', 'Pending'), ('approved', 'Approved'), ('rejected', 'Rejected'), ('recheck_pending', 'Recheck Pending')], default='not_uploaded', max_length=20)),
                ('level_three_kyc_required', models.BooleanField(default=False)),
                ('level_one_approved_date', models.DateTimeField(null=True)),
                ('level_two_approved_date', models.DateTimeField(null=True)),
                ('level_three_approved_date', models.DateTimeField(null=True)),
                ('ib_status', models.CharField(blank=True, choices=[('pending', 'Pending'), ('approved', 'Approved'), ('rejected', 'Rejected')], max_length=20, null=True)),
                ('start_trading', models.BooleanField(default=False)),
                ('last_active', models.DateTimeField(null=True)),
                ('last_transaction', models.DateTimeField(null=True)),
                ('last_trade', models.DateTimeField(null=True)),
                ('lead_status', models.CharField(choices=[('new', 'New'), ('contacted', 'Contacted'), ('qualified', 'Qualified'), ('converted', 'Converted'), ('lost', 'Lost')], default='new', max_length=20)),
                ('call_status', models.CharField(blank=True, max_length=50)),
                ('accepted_declarations', models.JSONField(default=list)),
                ('ib', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='referred_customers', to='customers.customer')),
            ],
            options={
                'verbose_name_plural': 'customers',
                'db_table': 'customers',
                'permissions': [('view_own_customers', 'Can view own assigned customers'), ('view_team_customers', "Can view team's customers"), ('view_all_customers', 'Can view all customers'), ('assign_customers', 'Can assign customers to CRM users'), ('manage_sensitive_data', 'Can manage sensitive customer data'), ('view_own_leads', 'Can view own leads'), ('view_team_leads', 'Can view team leads'), ('view_all_leads', 'Can view all leads'), ('add_lead', 'Can add lead'), ('change_lead', 'Can change lead'), ('delete_lead', 'Can delete lead'), ('view_own_clients', 'Can view own clients'), ('view_team_clients', 'Can view team clients'), ('view_all_clients', 'Can view all clients'), ('add_client', 'Can add client'), ('change_client', 'Can change client'), ('delete_client', 'Can delete client'), ('view_own_ibs', 'Can view own IBs'), ('view_team_ibs', 'Can view team IBs'), ('view_all_ibs', 'Can view all IBs'), ('add_ib', 'Can add IB'), ('change_ib', 'Can change IB'), ('delete_ib', 'Can delete IB')],
            },
        ),
        migrations.CreateModel(
            name='CustomerAuth',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.CharField(blank=True, max_length=255, null=True)),
                ('updated_by', models.CharField(blank=True, max_length=255, null=True)),
                ('password', models.CharField(max_length=128)),
                ('last_login', models.DateTimeField(null=True)),
                ('is_active', models.BooleanField(default=True)),
                ('customer', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='auth', to='customers.customer')),
            ],
            options={
                'db_table': 'customer_auth',
            },
        ),
        migrations.CreateModel(
            name='CustomerDetail',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.CharField(blank=True, max_length=255, null=True)),
                ('updated_by', models.CharField(blank=True, max_length=255, null=True)),
                ('title', models.CharField(blank=True, max_length=10)),
                ('dob', models.DateField(null=True)),
                ('nationality', models.CharField(blank=True, max_length=2)),
                ('city', models.CharField(blank=True, max_length=100)),
                ('address', models.TextField(blank=True)),
                ('address2', models.TextField(blank=True)),
                ('gender', models.CharField(blank=True, max_length=1)),
                ('zip_code', models.CharField(blank=True, max_length=20)),
                ('language', models.CharField(default='EN', max_length=2)),
                ('referral', models.CharField(default=shared_models.common.utils.generate_referral_code, max_length=20, unique=True)),
                ('register_referral', models.CharField(blank=True, max_length=100)),
                ('register_utm_campaign', models.CharField(blank=True, max_length=100)),
                ('register_ib_id', models.CharField(blank=True, max_length=100)),
                ('register_agreement_id', models.CharField(blank=True, max_length=100)),
                ('register_url', models.CharField(blank=True, max_length=255)),
                ('register_data', models.JSONField(default=dict)),
                ('us_citizen', models.BooleanField(default=False)),
                ('worked_in_financial', models.BooleanField(default=False)),
                ('worked_in_crypto', models.BooleanField(default=False)),
                ('tax_identification_number', models.CharField(blank=True, max_length=50)),
                ('politically_exposed', models.BooleanField(default=False)),
                ('annual_income', models.CharField(blank=True, max_length=50)),
                ('source_of_funds', models.CharField(blank=True, max_length=50)),
                ('fatca', models.BooleanField(default=False)),
                ('doc_type', models.CharField(blank=True, max_length=50)),
                ('document_no', models.CharField(blank=True, max_length=50)),
                ('date_of_issue', models.DateField(null=True)),
                ('date_of_expiry', models.DateField(null=True)),
                ('country_of_issue', models.CharField(blank=True, max_length=2)),
                ('employment_status', models.CharField(blank=True, max_length=50)),
                ('industry', models.CharField(blank=True, max_length=100)),
                ('profession', models.CharField(blank=True, max_length=100)),
                ('job_title', models.CharField(blank=True, max_length=100)),
                ('employer', models.CharField(blank=True, max_length=100)),
                ('have_site', models.CharField(blank=True, max_length=255, null=True)),
                ('ref_other', models.CharField(blank=True, max_length=255, null=True)),
                ('target_countries', models.JSONField(blank=True, null=True)),
                ('get_client', models.CharField(blank=True, max_length=255, null=True)),
                ('expected_clients', models.IntegerField(blank=True, null=True)),
                ('hubspot_id', models.CharField(blank=True, max_length=100)),
                ('old_record_id', models.CharField(blank=True, max_length=100)),
                ('sumsub_app_id', models.CharField(blank=True, max_length=100, null=True)),
                ('sumsub_ins_id', models.CharField(blank=True, max_length=100, null=True)),
                ('client_at', models.DateTimeField(null=True)),
                ('ib_at', models.DateTimeField(null=True)),
                ('lead_at', models.DateTimeField(null=True)),
                ('customer', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='details', to='customers.customer')),
            ],
            options={
                'db_table': 'customer_details',
            },
        ),
        migrations.CreateModel(
            name='CustomerSettings',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.CharField(blank=True, max_length=255, null=True)),
                ('updated_by', models.CharField(blank=True, max_length=255, null=True)),
                ('verification_status', models.JSONField(default=dict)),
                ('transaction_controls', models.JSONField(default=dict)),
                ('trading_controls', models.JSONField(default=dict)),
                ('notification_preferences', models.JSONField(default=dict)),
                ('customer', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='settings', to='customers.customer')),
            ],
            options={
                'db_table': 'customer_settings',
            },
        ),
    ]
