# Generated by Django 5.2.7 on 2025-10-22 16:16

import django.db.models.deletion

from django.db import migrations, models

import svs_core.db.models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="TemplateModel",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("name", models.CharField(max_length=255)),
                (
                    "type",
                    models.CharField(
                        choices=[("image", "IMAGE"), ("build", "BUILD")],
                        default=svs_core.db.models.TemplateType["IMAGE"],
                        max_length=10,
                    ),
                ),
                ("image", models.CharField(blank=True, max_length=255, null=True)),
                ("dockerfile", models.TextField(blank=True, null=True)),
                ("description", models.TextField(blank=True, null=True)),
                ("default_env", models.JSONField(blank=True, default=dict, null=True)),
                (
                    "default_ports",
                    models.JSONField(blank=True, default=list, null=True),
                ),
                (
                    "default_volumes",
                    models.JSONField(blank=True, default=list, null=True),
                ),
                ("start_cmd", models.CharField(blank=True, max_length=512, null=True)),
                ("healthcheck", models.JSONField(blank=True, default=dict, null=True)),
                ("labels", models.JSONField(blank=True, default=dict, null=True)),
                ("args", models.JSONField(blank=True, default=list, null=True)),
            ],
            options={
                "db_table": "templates",
            },
        ),
        migrations.CreateModel(
            name="UserModel",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("name", models.CharField(max_length=255, unique=True)),
                ("password", models.CharField(max_length=255, null=True)),
            ],
            options={
                "db_table": "users",
            },
        ),
        migrations.CreateModel(
            name="ServiceModel",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("name", models.CharField(max_length=255)),
                (
                    "container_id",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                ("image", models.CharField(blank=True, max_length=255, null=True)),
                ("domain", models.CharField(blank=True, max_length=255, null=True)),
                ("env", models.JSONField(blank=True, default=dict, null=True)),
                (
                    "exposed_ports",
                    models.JSONField(blank=True, default=list, null=True),
                ),
                ("volumes", models.JSONField(blank=True, default=list, null=True)),
                ("command", models.CharField(blank=True, max_length=512, null=True)),
                ("labels", models.JSONField(blank=True, default=dict, null=True)),
                ("args", models.JSONField(blank=True, default=list, null=True)),
                ("healthcheck", models.JSONField(blank=True, default=dict, null=True)),
                ("networks", models.JSONField(blank=True, default=list, null=True)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("created", "CREATED"),
                            ("running", "RUNNING"),
                            ("stopped", "STOPPED"),
                            ("exited", "EXITED"),
                            ("error", "ERROR"),
                        ],
                        default=svs_core.db.models.ServiceStatus["CREATED"],
                        max_length=10,
                    ),
                ),
                ("exit_code", models.IntegerField(blank=True, null=True)),
                (
                    "template",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="services",
                        to="svs_core.templatemodel",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="services",
                        to="svs_core.usermodel",
                    ),
                ),
            ],
            options={
                "db_table": "services",
            },
        ),
    ]
