import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('accounts', '0011_organization_default_monthly_fee'),
    ]

    operations = [
        migrations.CreateModel(
            name='Student',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150)),
                ('dob', models.CharField(blank=True, max_length=20)),
                ('gender', models.CharField(blank=True, max_length=10)),
                ('guardian_name', models.CharField(blank=True, max_length=150)),
                ('phone', models.CharField(blank=True, max_length=20)),
                ('email', models.EmailField(blank=True, max_length=254)),
                ('address', models.TextField(blank=True)),
                ('batch_or_class', models.CharField(blank=True, help_text="e.g. 'Class 10', 'UPSC Batch A'", max_length=100)),
                ('monthly_fee', models.IntegerField(blank=True, null=True)),
                ('photo_base64', models.TextField(blank=True)),
                ('admission_date', models.DateField(default=django.utils.timezone.now)),
                ('is_active', models.BooleanField(default=True)),
                ('added_via_qr', models.BooleanField(default=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('org', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='students', to='accounts.organization')),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Attendance',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateField()),
                ('event', models.CharField(choices=[('IN', 'In'), ('OUT', 'Out')], max_length=3)),
                ('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
                ('org', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attendance_records', to='accounts.organization')),
                ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attendance_records', to='students.student')),
            ],
            options={
                'ordering': ['-timestamp'],
            },
        ),
        migrations.CreateModel(
            name='FeePayment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('month', models.CharField(help_text='Format: YYYY-MM', max_length=7)),
                ('amount', models.IntegerField()),
                ('paid_date', models.DateField(default=django.utils.timezone.now)),
                ('method', models.CharField(blank=True, help_text='Cash, UPI, Bank Transfer, etc.', max_length=30)),
                ('notes', models.TextField(blank=True)),
                ('recorded_by', models.CharField(blank=True, max_length=150)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('org', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fee_payments', to='accounts.organization')),
                ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fee_payments', to='students.student')),
            ],
            options={
                'ordering': ['-paid_date'],
                'unique_together': {('student', 'month')},
            },
        ),
    ]
