# Generated by Django 5.2.6 on 2025-10-01 02:21

import _socket
import django.core.validators
import django.db.models.deletion
import django.utils.timezone
import django_audit_fields.fields.hostname_modification_field
import django_audit_fields.fields.userfield
import django_audit_fields.fields.uuid_auto_field
import django_revision.revision_field
import edc_model.models.fields.other_charfield
import edc_model.validators.date
import edc_protocol.validators
import edc_visit_tracking.managers
import simple_history.models
import uuid
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("edc_he", "0010_delete_historicaleducationtype"),
        ("meta_subject", "0234_remove_spfq_site_remove_spfq_subject_visit_and_more"),
        ("sites", "0002_alter_domain_unique"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="HistoricalEducation",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        default="",
                        editable=False,
                        help_text="System field. From git repository (tag:branch:commit), project metadata, project toml, project VERSION, or settings.",
                        max_length=75,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(blank=True, default=django.utils.timezone.now),
                ),
                (
                    "modified",
                    models.DateTimeField(blank=True, default=django.utils.timezone.now),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        default="",
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        default="",
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                        verbose_name="Hostname created",
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.HostnameModificationField(
                        blank=True,
                        default="",
                        help_text="System field. (modified on every save)",
                        max_length=50,
                        verbose_name="Hostname modified",
                    ),
                ),
                (
                    "device_created",
                    models.CharField(
                        blank=True,
                        default="",
                        max_length=10,
                        verbose_name="Device created",
                    ),
                ),
                (
                    "device_modified",
                    models.CharField(
                        blank=True,
                        default="",
                        max_length=10,
                        verbose_name="Device modified",
                    ),
                ),
                (
                    "locale_created",
                    models.CharField(
                        blank=True,
                        default="",
                        help_text="Auto-updated by Modeladmin",
                        max_length=10,
                        verbose_name="Locale created",
                    ),
                ),
                (
                    "locale_modified",
                    models.CharField(
                        blank=True,
                        default="",
                        help_text="Auto-updated by Modeladmin",
                        max_length=10,
                        verbose_name="Locale modified",
                    ),
                ),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        db_index=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                    ),
                ),
                (
                    "consent_model",
                    models.CharField(blank=True, default="", max_length=50),
                ),
                (
                    "consent_version",
                    models.CharField(blank=True, default="", max_length=10),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=django.utils.timezone.now,
                        help_text="If reporting today, use today's date/time, otherwise use the date/time this information was reported.",
                        validators=[
                            edc_protocol.validators.datetime_not_before_study_start,
                            edc_model.validators.date.datetime_not_future,
                        ],
                        verbose_name="Report Date",
                    ),
                ),
                (
                    "education_in_years",
                    models.IntegerField(
                        validators=[
                            django.core.validators.MinValueValidator(0),
                            django.core.validators.MaxValueValidator(30),
                        ],
                        verbose_name="How many years of education did you complete?",
                    ),
                ),
                (
                    "education_certificate",
                    models.CharField(
                        choices=[
                            ("primary", "Primary Certificate"),
                            ("secondary", "Secondary Certificate"),
                            ("tertiary", "post-Secondary/Tertiary/College"),
                            ("OTHER", "Other, specify ..."),
                            ("N/A", "Not applicable, never went to school"),
                        ],
                        default="",
                        max_length=50,
                        verbose_name="What is your highest education certificate?",
                    ),
                ),
                (
                    "education_certificate_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "education_certificate_tertiary",
                    models.CharField(
                        blank=True,
                        default="",
                        max_length=50,
                        verbose_name="If your highest education certificate above is `Tertiary`, what type of tertiary certificate?",
                    ),
                ),
                (
                    "primary_school",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        max_length=15,
                        verbose_name="Did you go to primary/elementary school?",
                    ),
                ),
                (
                    "primary_school_in_years",
                    models.IntegerField(
                        blank=True,
                        null=True,
                        validators=[
                            django.core.validators.MinValueValidator(0),
                            django.core.validators.MaxValueValidator(10),
                        ],
                        verbose_name="If YES, for how many years",
                    ),
                ),
                (
                    "secondary_school",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        max_length=15,
                        verbose_name="Did you go to secondary school?",
                    ),
                ),
                (
                    "secondary_school_in_years",
                    models.IntegerField(
                        blank=True,
                        null=True,
                        validators=[
                            django.core.validators.MinValueValidator(0),
                            django.core.validators.MaxValueValidator(10),
                        ],
                        verbose_name="If YES, for how many years",
                    ),
                ),
                (
                    "higher_education",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        max_length=15,
                        verbose_name="Did you go to higher education?",
                    ),
                ),
                (
                    "higher_education_in_years",
                    models.IntegerField(
                        blank=True,
                        null=True,
                        validators=[
                            django.core.validators.MinValueValidator(0),
                            django.core.validators.MaxValueValidator(20),
                        ],
                        verbose_name="If YES, for how many years",
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField(db_index=True)),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="sites.site",
                    ),
                ),
                (
                    "subject_visit",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="meta_subject.subjectvisit",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Health Economics: Education",
                "verbose_name_plural": "historical Health Economics: Education",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": ("history_date", "history_id"),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="Education",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        default="",
                        editable=False,
                        help_text="System field. From git repository (tag:branch:commit), project metadata, project toml, project VERSION, or settings.",
                        max_length=75,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(blank=True, default=django.utils.timezone.now),
                ),
                (
                    "modified",
                    models.DateTimeField(blank=True, default=django.utils.timezone.now),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        default="",
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        default="",
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                        verbose_name="Hostname created",
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.HostnameModificationField(
                        blank=True,
                        default="",
                        help_text="System field. (modified on every save)",
                        max_length=50,
                        verbose_name="Hostname modified",
                    ),
                ),
                (
                    "device_created",
                    models.CharField(
                        blank=True,
                        default="",
                        max_length=10,
                        verbose_name="Device created",
                    ),
                ),
                (
                    "device_modified",
                    models.CharField(
                        blank=True,
                        default="",
                        max_length=10,
                        verbose_name="Device modified",
                    ),
                ),
                (
                    "locale_created",
                    models.CharField(
                        blank=True,
                        default="",
                        help_text="Auto-updated by Modeladmin",
                        max_length=10,
                        verbose_name="Locale created",
                    ),
                ),
                (
                    "locale_modified",
                    models.CharField(
                        blank=True,
                        default="",
                        help_text="Auto-updated by Modeladmin",
                        max_length=10,
                        verbose_name="Locale modified",
                    ),
                ),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "consent_model",
                    models.CharField(blank=True, default="", max_length=50),
                ),
                (
                    "consent_version",
                    models.CharField(blank=True, default="", max_length=10),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=django.utils.timezone.now,
                        help_text="If reporting today, use today's date/time, otherwise use the date/time this information was reported.",
                        validators=[
                            edc_protocol.validators.datetime_not_before_study_start,
                            edc_model.validators.date.datetime_not_future,
                        ],
                        verbose_name="Report Date",
                    ),
                ),
                (
                    "education_in_years",
                    models.IntegerField(
                        validators=[
                            django.core.validators.MinValueValidator(0),
                            django.core.validators.MaxValueValidator(30),
                        ],
                        verbose_name="How many years of education did you complete?",
                    ),
                ),
                (
                    "education_certificate",
                    models.CharField(
                        choices=[
                            ("primary", "Primary Certificate"),
                            ("secondary", "Secondary Certificate"),
                            ("tertiary", "post-Secondary/Tertiary/College"),
                            ("OTHER", "Other, specify ..."),
                            ("N/A", "Not applicable, never went to school"),
                        ],
                        default="",
                        max_length=50,
                        verbose_name="What is your highest education certificate?",
                    ),
                ),
                (
                    "education_certificate_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "education_certificate_tertiary",
                    models.CharField(
                        blank=True,
                        default="",
                        max_length=50,
                        verbose_name="If your highest education certificate above is `Tertiary`, what type of tertiary certificate?",
                    ),
                ),
                (
                    "primary_school",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        max_length=15,
                        verbose_name="Did you go to primary/elementary school?",
                    ),
                ),
                (
                    "primary_school_in_years",
                    models.IntegerField(
                        blank=True,
                        null=True,
                        validators=[
                            django.core.validators.MinValueValidator(0),
                            django.core.validators.MaxValueValidator(10),
                        ],
                        verbose_name="If YES, for how many years",
                    ),
                ),
                (
                    "secondary_school",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        max_length=15,
                        verbose_name="Did you go to secondary school?",
                    ),
                ),
                (
                    "secondary_school_in_years",
                    models.IntegerField(
                        blank=True,
                        null=True,
                        validators=[
                            django.core.validators.MinValueValidator(0),
                            django.core.validators.MaxValueValidator(10),
                        ],
                        verbose_name="If YES, for how many years",
                    ),
                ),
                (
                    "higher_education",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        max_length=15,
                        verbose_name="Did you go to higher education?",
                    ),
                ),
                (
                    "higher_education_in_years",
                    models.IntegerField(
                        blank=True,
                        null=True,
                        validators=[
                            django.core.validators.MinValueValidator(0),
                            django.core.validators.MaxValueValidator(20),
                        ],
                        verbose_name="If YES, for how many years",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="sites.site",
                    ),
                ),
                (
                    "subject_visit",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="meta_subject.subjectvisit",
                    ),
                ),
            ],
            options={
                "verbose_name": "Health Economics: Education",
                "verbose_name_plural": "Health Economics: Education",
                "abstract": False,
                "default_permissions": (
                    "add",
                    "change",
                    "delete",
                    "view",
                    "export",
                    "import",
                ),
                "default_manager_name": "objects",
                "indexes": [
                    models.Index(
                        fields=["subject_visit", "site"],
                        name="edc_he_educ_subject_090335_idx",
                    ),
                    models.Index(
                        fields=["subject_visit", "report_datetime"],
                        name="edc_he_educ_subject_0e69d7_idx",
                    ),
                    models.Index(
                        fields=["modified", "created"],
                        name="edc_he_educ_modifie_db6e8d_idx",
                    ),
                    models.Index(
                        fields=["user_modified", "user_created"],
                        name="edc_he_educ_user_mo_0dec5b_idx",
                    ),
                ],
            },
            managers=[
                ("objects", edc_visit_tracking.managers.CrfModelManager()),
                ("on_site", edc_visit_tracking.managers.CrfCurrentSiteManager()),
            ],
        ),
    ]
