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


class Migration(migrations.Migration):

    dependencies = [
        ("website", "0005_rename_website_tel_start_a_8a5f7f_idx_website_tel_start_a_5b57ad_idx_and_more"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Patient",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("full_name", models.CharField(max_length=140)),
                ("phone", models.CharField(db_index=True, max_length=40)),
                ("email", models.EmailField(blank=True, max_length=254)),
                ("date_of_birth", models.DateField(blank=True, null=True)),
                ("gender", models.CharField(blank=True, max_length=20)),
                ("address", models.CharField(blank=True, max_length=240)),
            ],
        ),
        migrations.CreateModel(
            name="ActivityLog",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("action", models.CharField(max_length=80)),
                ("summary", models.CharField(max_length=240)),
                ("meta", models.JSONField(blank=True, default=dict)),
            ],
        ),
        migrations.AddField(
            model_name="telehealthbooking",
            name="fee_ngn",
            field=models.PositiveIntegerField(default=0),
        ),
        migrations.AddField(
            model_name="telehealthbooking",
            name="is_paid",
            field=models.BooleanField(default=False),
        ),
        migrations.AddField(
            model_name="telehealthbooking",
            name="paystack_reference",
            field=models.CharField(blank=True, max_length=64),
        ),
        migrations.AddField(
            model_name="telehealthbooking",
            name="patient",
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="telehealth_bookings", to="website.patient"),
        ),
        migrations.CreateModel(
            name="EMRNote",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("title", models.CharField(blank=True, max_length=140)),
                ("note", models.TextField()),
                ("created_by", models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ("patient", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name="notes", to="website.patient")),
            ],
        ),
        migrations.CreateModel(
            name="PaymentTransaction",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("purpose", models.CharField(choices=[("telehealth", "Telehealth Consultation"), ("care_request", "Care / Home Service Request")], max_length=40)),
                ("amount_ngn", models.PositiveIntegerField(default=0)),
                ("email", models.EmailField(blank=True, max_length=254)),
                ("reference", models.CharField(max_length=64, unique=True)),
                ("status", models.CharField(choices=[("initiated", "Initiated"), ("success", "Success"), ("failed", "Failed")], default="initiated", max_length=20)),
                ("paid_at", models.DateTimeField(blank=True, null=True)),
                ("raw_response", models.JSONField(blank=True, default=dict)),
                ("care_request", models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="payments", to="website.carerequest")),
                ("telehealth_booking", models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="payments", to="website.telehealthbooking")),
            ],
        ),
    ]
