# Generated by Django 5.2.8 on 2025-12-06 15:03

import apps.sigils.fields
import django.db.models.deletion
import utils.revision
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("chats", "0002_initial"),
        ("groups", "0002_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="Package",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                (
                    "name",
                    models.CharField(default="arthexis", max_length=100, unique=True),
                ),
                (
                    "description",
                    models.CharField(
                        default="Energy & Power Infrastructure", max_length=255
                    ),
                ),
                (
                    "author",
                    models.CharField(
                        default="Rafael J. Guillén-Osorio", max_length=100
                    ),
                ),
                (
                    "email",
                    models.EmailField(
                        default="tecnologia@gelectriic.com", max_length=254
                    ),
                ),
                ("python_requires", models.CharField(default=">=3.10", max_length=20)),
                ("license", models.CharField(default="GPL-3.0-only", max_length=100)),
                (
                    "repository_url",
                    models.URLField(default="https://github.com/arthexis/arthexis"),
                ),
                ("homepage_url", models.URLField(default="https://arthexis.com")),
                (
                    "version_path",
                    models.CharField(blank=True, default="", max_length=255),
                ),
                (
                    "dependencies_path",
                    models.CharField(blank=True, default="", max_length=255),
                ),
                ("test_command", models.TextField(blank=True, default="")),
                (
                    "is_active",
                    models.BooleanField(
                        default=False,
                        help_text="Designates the active package for version comparisons",
                    ),
                ),
            ],
            options={
                "verbose_name": "Package",
                "verbose_name_plural": "Packages",
            },
        ),
        migrations.CreateModel(
            name="PackageRelease",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                ("version", models.CharField(default="0.0.0", max_length=20)),
                (
                    "revision",
                    models.CharField(
                        blank=True,
                        default=utils.revision.get_revision,
                        editable=False,
                        max_length=40,
                    ),
                ),
                (
                    "severity",
                    models.CharField(
                        choices=[
                            ("normal", "Normal"),
                            ("low", "Low"),
                            ("critical", "Critical"),
                        ],
                        default="normal",
                        help_text="Controls the expected urgency for auto-upgrades.",
                        max_length=16,
                    ),
                ),
                (
                    "pypi_url",
                    models.URLField(
                        blank=True, editable=False, verbose_name="PyPI URL"
                    ),
                ),
                (
                    "github_url",
                    models.URLField(
                        blank=True, editable=False, verbose_name="GitHub URL"
                    ),
                ),
                (
                    "release_on",
                    models.DateTimeField(blank=True, editable=False, null=True),
                ),
                ("scheduled_date", models.DateField(blank=True, null=True)),
                ("scheduled_time", models.TimeField(blank=True, null=True)),
                (
                    "package",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="releases",
                        to="release.package",
                    ),
                ),
            ],
            options={
                "verbose_name": "Package Release",
                "verbose_name_plural": "Package Releases",
                "get_latest_by": "version",
            },
        ),
        migrations.CreateModel(
            name="ReleaseManager",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                (
                    "pypi_username",
                    apps.sigils.fields.SigilShortAutoField(
                        blank=True, max_length=100, verbose_name="PyPI username"
                    ),
                ),
                (
                    "pypi_token",
                    apps.sigils.fields.SigilShortAutoField(
                        blank=True, max_length=200, verbose_name="PyPI token"
                    ),
                ),
                (
                    "github_token",
                    apps.sigils.fields.SigilShortAutoField(
                        blank=True,
                        help_text="Personal access token for GitHub operations. Used before the GITHUB_TOKEN environment variable.",
                        max_length=200,
                    ),
                ),
                (
                    "git_username",
                    apps.sigils.fields.SigilShortAutoField(
                        blank=True,
                        help_text="Username used for Git pushes (for example, your GitHub username).",
                        max_length=100,
                        verbose_name="Git username",
                    ),
                ),
                (
                    "git_password",
                    apps.sigils.fields.SigilShortAutoField(
                        blank=True,
                        help_text="Password or personal access token for HTTPS Git pushes. Leave blank to use the GitHub token instead.",
                        max_length=200,
                        verbose_name="Git password/token",
                    ),
                ),
                (
                    "pypi_password",
                    apps.sigils.fields.SigilShortAutoField(
                        blank=True, max_length=200, verbose_name="PyPI password"
                    ),
                ),
                (
                    "pypi_url",
                    apps.sigils.fields.SigilShortAutoField(
                        blank=True,
                        help_text="Link to the PyPI user profile (for example, https://pypi.org/user/username/). Use the account's user page, not a project-specific URL. This value is informational and not used for uploads.",
                        max_length=200,
                        verbose_name="PyPI URL",
                    ),
                ),
                (
                    "secondary_pypi_url",
                    apps.sigils.fields.SigilShortAutoField(
                        blank=True,
                        help_text="Optional secondary repository upload endpoint. Leave blank to disable mirrored uploads.",
                        max_length=200,
                        verbose_name="Secondary PyPI URL",
                    ),
                ),
                (
                    "avatar",
                    models.ForeignKey(
                        blank=True,
                        help_text="Avatar that owns this profile when not linked directly to a user or group.",
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="chats.chatavatar",
                    ),
                ),
                (
                    "group",
                    models.OneToOneField(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="groups.securitygroup",
                    ),
                ),
            ],
            options={
                "verbose_name": "Release Manager",
                "verbose_name_plural": "Release Managers",
            },
        ),
    ]
