from django.db import migrations

def create_bda(apps, schema_editor):
    """
    The club BDA is now pre-injected.
    """
    Club = apps.get_model("member", "club")
    NoteClub = apps.get_model("note", "noteclub")
    Alias = apps.get_model("note", "alias")
    ContentType = apps.get_model('contenttypes', 'ContentType')
    polymorphic_ctype_id = ContentType.objects.get_for_model(NoteClub).id
    
    Club.objects.get_or_create(
        id=10,
        name="BDA",
        email="bda.ensparissaclay@gmail.com",
        require_memberships=True,
        membership_fee_paid=750,
        membership_fee_unpaid=750,
        membership_duration=396,
        membership_start="2024-08-01",
        membership_end="2025-09-30",
    )
    NoteClub.objects.get_or_create(
        id=1937,
        club_id=10,
        polymorphic_ctype_id=polymorphic_ctype_id,
    )
    Alias.objects.get_or_create(
        id=1937,
        note_id=1937,
        name="BDA",
        normalized_name="bda",
    )


class Migration(migrations.Migration):

    dependencies = [
        ('member', '0013_auto_20240801_1436'),
    ]
    
    operations = [
        migrations.RunPython(create_bda),
    ]

