# Generated by Django 5.1.4 on 2025-02-08 12:42

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


class Migration(migrations.Migration):

    dependencies = [
        ('system_settings', '0007_remove_accounttype_default_group_type_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='PaymentGatewayConfig',
            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)),
                ('gateway', models.CharField(help_text='Unique identifier for the gateway', max_length=50, unique=True)),
                ('display_name', models.CharField(max_length=100)),
                ('enable', models.BooleanField(default=True)),
                ('enable_crm', models.BooleanField(default=True)),
                ('enable_cp', models.BooleanField(default=False)),
                ('is_external', models.BooleanField(default=False, help_text='If True, this is an external payment provider')),
                ('enabled_countries', models.JSONField(blank=True, default=list, help_text='List of country codes where this gateway is enabled')),
                ('disabled_countries', models.JSONField(blank=True, default=list, help_text='List of country codes where this gateway is disabled')),
                ('charge_fees', models.BooleanField(default=False)),
                ('fixed_fee', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
                ('percentage_fee', models.DecimalField(decimal_places=2, default=0, max_digits=5)),
                ('payment_method', models.CharField(blank=True, choices=[('WIRE', 'Wire Transfer'), ('CRYPTO', 'Cryptocurrency'), ('CARD', 'Credit/Debit Card'), ('MANUAL', 'Manual'), ('SYSTEM', 'System Generated')], max_length=10, null=True)),
                ('config', models.JSONField(blank=True, default=dict, help_text='Additional configuration specific to this gateway')),
            ],
            options={
                'verbose_name': 'Payment Gateway Configuration',
                'verbose_name_plural': 'Payment Gateway Configurations',
                'db_table': 'payment_gateway_configs',
                'ordering': ['gateway'],
            },
        ),
        migrations.CreateModel(
            name='PaymentMethodConfig',
            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)),
                ('payment_method', models.CharField(choices=[('WIRE', 'Wire Transfer'), ('CRYPTO', 'Cryptocurrency'), ('CARD', 'Credit/Debit Card'), ('MANUAL', 'Manual'), ('SYSTEM', 'System Generated')], max_length=10)),
                ('is_enabled', models.BooleanField(default=True)),
                ('requires_manual_approval', models.BooleanField(default=True)),
                ('requires_evidence', models.BooleanField(default=True)),
                ('display_name', models.CharField(max_length=100)),
                ('allowed_transaction_types', models.JSONField(default=list, help_text='List of transaction types allowed for this payment method')),
                ('min_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True)),
                ('max_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True)),
                ('metadata_schema', models.JSONField(default=dict, help_text='Required fields and validations for this payment method')),
                ('approval_roles', models.JSONField(default=list, help_text='Roles that can approve transactions with this payment method')),
                ('allowed_gateways', models.ManyToManyField(related_name='payment_methods', to='system_settings.paymentgatewayconfig')),
                ('default_gateway', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='default_for_methods', to='system_settings.paymentgatewayconfig')),
            ],
            options={
                'db_table': 'payment_method_configs',
                'ordering': ['payment_method'],
            },
        ),
        migrations.CreateModel(
            name='TransactionTypeConfig',
            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)),
                ('transaction_type', models.CharField(choices=[('DEPOSIT', 'Deposit'), ('WITHDRAWAL', 'Withdrawal'), ('BONUS', 'Bonus'), ('REBATE', 'Rebate'), ('COMMISSION', 'Commission'), ('CORRECTION', 'Correction'), ('INTERNAL_TRANSFER', 'Internal Transfer'), ('CREDIT', 'Credit'), ('CHARGE', 'Charge'), ('COMPENSATION', 'Compensation')], max_length=20)),
                ('allows_in', models.BooleanField(default=True)),
                ('allows_out', models.BooleanField(default=True)),
                ('requires_approval', models.BooleanField(default=True)),
                ('approval_roles', models.JSONField(default=list, help_text='Roles that can approve this transaction type')),
                ('min_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True)),
                ('max_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True)),
                ('rules', models.JSONField(default=dict, help_text='Type-specific configuration and rules')),
                ('requires_reason', models.BooleanField(default=False)),
                ('requires_documentation', models.BooleanField(default=False)),
                ('auto_approve_threshold', models.DecimalField(blank=True, decimal_places=2, help_text='Amount below which transactions are auto-approved', max_digits=20, null=True)),
            ],
            options={
                'db_table': 'transaction_type_configs',
                'ordering': ['transaction_type'],
                'unique_together': {('transaction_type',)},
            },
        ),
    ]
