# Generated by Django 5.2.8 on 2025-11-27 04:43

import django.core.validators
import django.db.models.deletion
from decimal import Decimal
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('schedule', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='TransactionLink',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('payment_intent_id', models.CharField(db_index=True, help_text='Stripe PaymentIntent ID', max_length=255, unique=True)),
                ('amount', models.DecimalField(decimal_places=2, help_text='Total amount in tenant currency', max_digits=10, validators=[django.core.validators.MinValueValidator(Decimal('0.01'))])),
                ('application_fee_amount', models.DecimalField(decimal_places=2, help_text='Platform fee amount (e.g., 5% of total)', max_digits=10, validators=[django.core.validators.MinValueValidator(Decimal('0.00'))])),
                ('currency', models.CharField(default='USD', help_text='ISO 4217 currency code', max_length=3)),
                ('status', models.CharField(choices=[('PENDING', 'Pending'), ('PROCESSING', 'Processing'), ('SUCCEEDED', 'Succeeded'), ('FAILED', 'Failed'), ('REFUNDED', 'Refunded'), ('CANCELED', 'Canceled')], db_index=True, default='PENDING', max_length=20)),
                ('payment_method_id', models.CharField(blank=True, help_text='Stripe PaymentMethod ID', max_length=255)),
                ('locale', models.CharField(default='en', help_text='Language preference for receipts (en/es/fr/de)', max_length=10)),
                ('error_message', models.TextField(blank=True, help_text='Error details if payment failed')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('completed_at', models.DateTimeField(blank=True, help_text='When payment succeeded', null=True)),
                ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='schedule.event')),
            ],
            options={
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['status', 'created_at'], name='payments_tr_status_2bf70c_idx'), models.Index(fields=['event', 'status'], name='payments_tr_event_i_de0135_idx')],
            },
        ),
    ]
