# Generated by Django 5.1.4 on 2025-02-02 18:02

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('customers', '0001_initial'),
        ('system_settings', '0005_accountsequence_accounttype'),
    ]

    operations = [
        migrations.CreateModel(
            name='Account',
            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)),
                ('login', models.IntegerField()),
                ('is_active', models.BooleanField(default=True)),
                ('group_type', models.CharField(default='standard', help_text="Current group type (e.g., 'standard', 'bonus')", max_length=20)),
                ('is_swap_free', models.BooleanField(default=False, help_text='Whether this account uses Islamic (swap-free) groups')),
                ('account_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='accounts', to='system_settings.accounttype')),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='accounts', to='customers.customer')),
                ('server', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='accounts', to='system_settings.tradingplatformserver')),
            ],
            options={
                'verbose_name': 'Account',
                'verbose_name_plural': 'Accounts',
                'db_table': 'accounts',
                'permissions': [('change_account_group', 'Can change account group')],
                'indexes': [models.Index(fields=['login', 'server'], name='accounts_login_45ea65_idx'), models.Index(fields=['customer'], name='accounts_custome_756e3c_idx'), models.Index(fields=['account_type'], name='accounts_account_dd58b9_idx')],
                'unique_together': {('login', 'server')},
            },
        ),
    ]
