# Generated by Django 4.2.3 on 2023-07-29 00:43

import django.contrib.gis.db.models.fields
import django.db.models.deletion
from django.db import migrations, models

import utils.file_utils


class Migration(migrations.Migration):

    dependencies = [
        ("users", "0002_remove_user_bio_profile"),
        ("challenges", "0001_initial"),
        ("planner", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="Attempt",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("start_datetime", models.DateTimeField(default=None, null=True)),
                ("end_datetime", models.DateTimeField(default=None, null=True)),
                (
                    "run_notes",
                    models.CharField(default=None, max_length=1024, null=True),
                ),
                (
                    "challenge",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="challenges.challenge",
                    ),
                ),
                (
                    "profile",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="users.profile"
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Route",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "profiles",
                    models.ManyToManyField(
                        related_name="profiles",
                        through="planner.Attempt",
                        to="users.profile",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Segment",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("nickname", models.CharField(default=None, max_length=32, null=True)),
                ("order", models.IntegerField(default=None, null=True)),
                (
                    "segments",
                    django.contrib.gis.db.models.fields.LineStringField(srid=4326),
                ),
                (
                    "travel_mode",
                    models.IntegerField(
                        choices=[(1, "T"), (2, "WALKING"), (3, "RUNNING")], default=1
                    ),
                ),
                (
                    "start_photo",
                    models.ImageField(
                        default=None,
                        null=True,
                        upload_to=utils.file_utils.challenge_directory_path,
                    ),
                ),
                (
                    "end_photo",
                    models.ImageField(
                        default=None,
                        null=True,
                        upload_to=utils.file_utils.challenge_directory_path,
                    ),
                ),
                ("start_datetime", models.DateTimeField(default=None, null=True)),
                ("end_datetime", models.DateTimeField(default=None, null=True)),
                ("start_stop_id", models.IntegerField(default=None, null=True)),
                ("end_stop_id", models.IntegerField(default=None, null=True)),
                ("notes", models.CharField(default=None, max_length=1024, null=True)),
            ],
        ),
        migrations.CreateModel(
            name="Stop",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(default=None, max_length=32, null=True)),
                (
                    "description",
                    models.CharField(default=None, max_length=128, null=True),
                ),
                ("location", django.contrib.gis.db.models.fields.PointField(srid=4326)),
                ("mbta_id", models.IntegerField(default=None, null=True)),
                ("station_profile", models.JSONField(default=None, null=True)),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.DeleteModel(
            name="Myplaces",
        ),
        migrations.AddField(
            model_name="route",
            name="segments",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to="planner.segment"
            ),
        ),
        migrations.AddField(
            model_name="attempt",
            name="route",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to="planner.route"
            ),
        ),
    ]
