# Generated manually based on FINAL-IMPLEMENTATION-REQUIREMENTS.md
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('igny8_core_auth', '0006_soft_delete_and_retention'),
    ]

    operations = [
        # Add payment_method to Account
        migrations.AddField(
            model_name='account',
            name='payment_method',
            field=models.CharField(
                max_length=30,
                choices=[
                    ('stripe', 'Stripe'),
                    ('paypal', 'PayPal'),
                    ('bank_transfer', 'Bank Transfer'),
                ],
                default='stripe',
                help_text='Payment method used for this account'
            ),
        ),
        # Add payment_method to Subscription
        migrations.AddField(
            model_name='subscription',
            name='payment_method',
            field=models.CharField(
                max_length=30,
                choices=[
                    ('stripe', 'Stripe'),
                    ('paypal', 'PayPal'),
                    ('bank_transfer', 'Bank Transfer'),
                ],
                default='stripe',
                help_text='Payment method for this subscription'
            ),
        ),
        # Add external_payment_id to Subscription
        migrations.AddField(
            model_name='subscription',
            name='external_payment_id',
            field=models.CharField(
                max_length=255,
                blank=True,
                null=True,
                help_text='External payment reference (bank transfer ref, PayPal transaction ID)'
            ),
        ),
        # Make stripe_subscription_id nullable
        migrations.AlterField(
            model_name='subscription',
            name='stripe_subscription_id',
            field=models.CharField(
                max_length=255,
                blank=True,
                null=True,
                db_index=True,
                help_text='Stripe subscription ID (when using Stripe)'
            ),
        ),
        # Add pending_payment status to Account
        migrations.AlterField(
            model_name='account',
            name='status',
            field=models.CharField(
                max_length=20,
                choices=[
                    ('active', 'Active'),
                    ('suspended', 'Suspended'),
                    ('trial', 'Trial'),
                    ('cancelled', 'Cancelled'),
                    ('pending_payment', 'Pending Payment'),
                ],
                default='trial'
            ),
        ),
        # Add pending_payment status to Subscription
        migrations.AlterField(
            model_name='subscription',
            name='status',
            field=models.CharField(
                max_length=20,
                choices=[
                    ('active', 'Active'),
                    ('past_due', 'Past Due'),
                    ('canceled', 'Canceled'),
                   ('trialing', 'Trialing'),
                    ('pending_payment', 'Pending Payment'),
                ]
            ),
        ),
        # Add index on payment_method
        migrations.AddIndex(
            model_name='account',
            index=models.Index(fields=['payment_method'], name='auth_acc_payment_idx'),
        ),
        migrations.AddIndex(
            model_name='subscription',
            index=models.Index(fields=['payment_method'], name='auth_sub_payment_idx'),
        ),
    ]