# Generated by Django 6.0.6 on 2026-07-11 22:09

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Family',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(blank=True, max_length=255, verbose_name='name')),
            ],
            options={
                'verbose_name': 'family',
                'verbose_name_plural': 'families',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Member',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('first_name', models.CharField(max_length=150, verbose_name='first name')),
                ('last_name', models.CharField(max_length=150, verbose_name='last name')),
                ('date_of_birth', models.DateField(blank=True, null=True, verbose_name='date of birth')),
                ('email', models.EmailField(blank=True, max_length=254, verbose_name='email')),
                ('phone', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None, verbose_name='phone number')),
                ('emergency_phone', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None, verbose_name='emergency phone number')),
                ('user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='member', to=settings.AUTH_USER_MODEL, verbose_name='user')),
            ],
            options={
                'verbose_name': 'member',
                'verbose_name_plural': 'members',
                'ordering': ['last_name', 'first_name'],
            },
        ),
        migrations.CreateModel(
            name='FamilyMembership',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('role', models.CharField(choices=[('parent', 'parent'), ('child', 'child'), ('guardian', 'guardian'), ('other', 'other')], default='parent', max_length=255, verbose_name='role')),
                ('family', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='memberships', to='members.family', verbose_name='family')),
                ('member', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='family_memberships', to='members.member', verbose_name='member')),
            ],
            options={
                'verbose_name': 'family membership',
                'verbose_name_plural': 'family memberships',
                'ordering': ['family', 'role', 'member__last_name', 'member__first_name'],
            },
        ),
        migrations.AddIndex(
            model_name='member',
            index=models.Index(fields=['last_name', 'first_name'], name='members_mem_last_na_92a910_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='familymembership',
            unique_together={('family', 'member')},
        ),
    ]
