# Generated by Django 5.0.4 on 2024-04-21 18:32

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


class Migration(migrations.Migration):
    dependencies = [
        ("api", "0005_remove_project_url_project_local_url_and_more"),
    ]

    operations = [
        migrations.RemoveField(
            model_name="project",
            name="cpus",
        ),
        migrations.RemoveField(
            model_name="project",
            name="is_active",
        ),
        migrations.RemoveField(
            model_name="project",
            name="local_url",
        ),
        migrations.RemoveField(
            model_name="project",
            name="ram",
        ),
        migrations.RemoveField(
            model_name="project",
            name="rstudio_version",
        ),
        migrations.RemoveField(
            model_name="project",
            name="tailscale_funnel_url",
        ),
        migrations.RemoveField(
            model_name="project",
            name="tailscale_serve_url",
        ),
        migrations.AddField(
            model_name="project",
            name="max_cpus",
            field=models.PositiveIntegerField(
                default=8, help_text="Maximum number of CPUs allocated to the project."
            ),
        ),
        migrations.AddField(
            model_name="project",
            name="max_ram",
            field=models.PositiveIntegerField(
                default=32,
                help_text="Maximum amount of RAM in GB allocated for the project.",
            ),
        ),
        migrations.CreateModel(
            name="Container",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "image",
                    models.CharField(
                        default="rocker/rstudio",
                        help_text="The name of the container image.",
                        max_length=255,
                    ),
                ),
                (
                    "tag",
                    models.CharField(
                        default="latest",
                        help_text="The tag of the container image.",
                        max_length=255,
                    ),
                ),
                (
                    "container_id",
                    models.CharField(
                        default="4Dj19",
                        help_text="The unique identifier of the container.",
                        max_length=5,
                        unique=True,
                    ),
                ),
                (
                    "ram",
                    models.PositiveIntegerField(
                        default=2,
                        help_text="Amount of RAM in GB allocated for the container.",
                    ),
                ),
                (
                    "cpus",
                    models.PositiveIntegerField(
                        default=2,
                        help_text="Number of CPUs allocated to the container.",
                    ),
                ),
                (
                    "local_url",
                    models.URLField(
                        default="",
                        help_text="Local URL to access this container's RStudio instance",
                        max_length=1024,
                    ),
                ),
                (
                    "tailscale_funnel_url",
                    models.URLField(
                        default="",
                        help_text="Tailscale Funnel URL to access this container's RStudio instance from the web",
                        max_length=1024,
                    ),
                ),
                (
                    "tailscale_serve_url",
                    models.URLField(
                        default="",
                        help_text="Tailscale Serve URL to access this container's RStudio instance from the tailnet",
                        max_length=1024,
                    ),
                ),
                (
                    "is_running",
                    models.BooleanField(
                        default=False,
                        help_text="Indicates whether the container is running",
                    ),
                ),
                (
                    "project",
                    models.ForeignKey(
                        help_text="The project to which this container belongs.",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="containers",
                        to="api.project",
                    ),
                ),
            ],
        ),
    ]
