# Generated by Django 5.1.4 on 2025-02-02 17:57

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


class Migration(migrations.Migration):

    dependencies = [
        ('system_settings', '0004_tradingplatformserver_connection_timeout_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='AccountSequence',
            fields=[
                ('created_at', models.DateTimeField(default=django.utils.timezone.now)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.IntegerField(blank=True, null=True)),
                ('updated_by', models.IntegerField(blank=True, null=True)),
                ('id', models.AutoField(editable=False, primary_key=True, serialize=False)),
                ('current_sequence', models.PositiveIntegerField(default=0)),
                ('last_used_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'Account Sequence',
                'verbose_name_plural': 'Account Sequences',
                'db_table': 'account_sequences',
            },
        ),
        migrations.CreateModel(
            name='AccountType',
            fields=[
                ('created_at', models.DateTimeField(default=django.utils.timezone.now)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.IntegerField(blank=True, null=True)),
                ('updated_by', models.IntegerField(blank=True, null=True)),
                ('id', models.AutoField(editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=50)),
                ('group_configurations', models.JSONField(default=dict, help_text='\n        Store different group configurations. Example:\n        {\n            "standard": {\n                "swap": "\\\\MT5_LIVE\\Standard",\n                "swap_free": "\\\\MT5_LIVE\\Standard_Islamic"\n            },\n            "bonus": {\n                "swap": "\\\\MT5_LIVE\\Standard_Bonus",\n                "swap_free": "\\\\MT5_LIVE\\Standard_Bonus_Islamic"\n            }\n        }\n        ')),
                ('default_group_type', models.CharField(default='standard', help_text="Default group type to use (e.g., 'standard', 'bonus')", max_length=20)),
                ('min_first_deposit', models.IntegerField(default=0)),
                ('leverages', models.JSONField(default=list)),
                ('default_leverage', models.IntegerField(default=100)),
                ('is_active', models.BooleanField(default=True)),
                ('show_cp', models.BooleanField(default=False)),
                ('show_crm', models.BooleanField(default=False)),
                ('show_agreement', models.BooleanField(default=False)),
                ('sequence', models.IntegerField(default=0)),
                ('account_type', models.CharField(choices=[('LIVE', 'LIVE'), ('DEMO', 'DEMO'), ('IB', 'IB')], default='LIVE', max_length=10)),
                ('platform', models.CharField(choices=[('MT5', 'MT5'), ('MT4', 'MT4'), ('VERTEX', 'VERTEX')], default='MT5', max_length=10)),
                ('max_unapproved_accounts', models.IntegerField(default=0)),
                ('server', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='account_types', to='system_settings.tradingplatformserver')),
            ],
            options={
                'verbose_name': 'Account Type',
                'verbose_name_plural': 'Account Types',
                'db_table': 'account_types',
                'permissions': [('manage_account_type_groups', 'Can manage account type groups')],
                'unique_together': {('name', 'server')},
            },
        ),
    ]
