# Generated by Django 5.2.17 on 2026-09-29 08:32

import django.db.models.deletion
import uuid
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('catalog_app', '0044_backfill_author_slugs'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='LegacyAuthorInvitation',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('payment_method', models.CharField(blank=True, choices=[('bank', 'Bank Transfer'), ('mpesa_send', 'M-Pesa — Send Money'), ('mpesa_paybill', 'M-Pesa — PayBill'), ('mpesa_till', 'M-Pesa — Till / Buy Goods')], max_length=20)),
                ('payment_account_name', models.CharField(blank=True, help_text='Account holder name (Bank) / registered name (M-Pesa Send Money) / registered business name (PayBill, Till).', max_length=255)),
                ('payment_reference', models.CharField(blank=True, help_text='Reference/narration to include with payments.', max_length=100)),
                ('payment_phone', models.CharField(blank=True, help_text='Required for M-Pesa Send Money (the number money is sent to); optional contact number otherwise.', max_length=20)),
                ('payment_email', models.EmailField(blank=True, help_text='Optional — used for payment notifications.', max_length=254)),
                ('payment_details_confirmed', models.BooleanField(default=False, help_text='Applicant confirmed these details are correct and belong to them / their authorized business.')),
                ('bank_name', models.CharField(blank=True, max_length=255)),
                ('bank_account_number', models.CharField(blank=True, max_length=50)),
                ('bank_branch', models.CharField(blank=True, max_length=255)),
                ('bank_branch_code', models.CharField(blank=True, max_length=20)),
                ('bank_account_type', models.CharField(blank=True, choices=[('savings', 'Savings'), ('current', 'Current')], max_length=10)),
                ('bank_swift_code', models.CharField(blank=True, max_length=20)),
                ('bank_address', models.TextField(blank=True)),
                ('recipient_address', models.TextField(blank=True)),
                ('payment_currency', models.CharField(blank=True, default='KES', max_length=10)),
                ('intermediary_bank_details', models.TextField(blank=True)),
                ('paybill_number', models.CharField(blank=True, max_length=20)),
                ('paybill_account_number', models.CharField(blank=True, max_length=100)),
                ('till_number', models.CharField(blank=True, max_length=20)),
                ('token', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, unique=True)),
                ('bio', models.TextField(blank=True)),
                ('address', models.TextField(blank=True, help_text='Party address for the Distribution & Consignment Agreement.')),
                ('id_number', models.CharField(blank=True, help_text='National ID / passport number, or company registration number for a legal entity.', max_length=100)),
                ('agreement_text_snapshot', models.TextField(blank=True)),
                ('signed_name', models.CharField(blank=True, help_text='Full name typed by the author as their signature.', max_length=255)),
                ('signed_at', models.DateTimeField(blank=True, null=True)),
                ('signed_ip_address', models.GenericIPAddressField(blank=True, null=True)),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('sent', 'Sent'), ('submitted', 'Submitted'), ('approved', 'Approved'), ('rejected', 'Rejected')], db_index=True, default='draft', max_length=20)),
                ('sent_at', models.DateTimeField(blank=True, null=True)),
                ('expires_at', models.DateTimeField(blank=True, help_text='Link is valid for 30 days from when it was (re)sent.', null=True)),
                ('reviewed_at', models.DateTimeField(blank=True, null=True)),
                ('rejection_reason', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('author', models.ForeignKey(help_text='The existing author this agreement is for.', on_delete=django.db.models.deletion.PROTECT, related_name='legacy_invitations', to='catalog_app.author')),
                ('books', models.ManyToManyField(blank=True, help_text='Existing books this specific invitation/agreement covers.', related_name='legacy_invitations', to='catalog_app.book')),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('package', models.ForeignKey(blank=True, help_text='Chosen by the author during signing — blank until submitted.', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='legacy_invitations', to='catalog_app.distributionpackage')),
                ('reviewed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reviewed_legacy_invitations', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Legacy Author Invitation',
                'verbose_name_plural': 'Legacy Author Invitations',
                'ordering': ['-created_at'],
            },
        ),
    ]
