# Generated by Django 5.2.15 on 2026-06-15 08:28

import django.db.models.deletion
import simple_history.models
import uuid
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('domains', '0001_initial'),
        ('services', '0001_initial'),
        ('technical', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='HistoricalHostingAccount',
            fields=[
                ('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('public_id', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False)),
                ('created_at', models.DateTimeField(blank=True, editable=False, verbose_name='Criado em')),
                ('updated_at', models.DateTimeField(blank=True, editable=False, verbose_name='Atualizado em')),
                ('plan_name', models.CharField(blank=True, max_length=120, verbose_name='Plano')),
                ('panel_type', models.CharField(choices=[('cpanel', 'cPanel'), ('plesk', 'Plesk'), ('directadmin', 'DirectAdmin'), ('custom', 'Personalizado'), ('none', 'Sem painel')], default='cpanel', max_length=20, verbose_name='Painel')),
                ('account_reference', models.CharField(blank=True, help_text='Identificador ou referência no cofre; nunca guardar a password.', max_length=150, verbose_name='Referência da conta')),
                ('document_root', models.CharField(blank=True, max_length=500, verbose_name='Pasta principal')),
                ('disk_quota_mb', models.PositiveBigIntegerField(blank=True, null=True, verbose_name='Espaço contratado (MB)')),
                ('disk_used_mb', models.PositiveBigIntegerField(blank=True, null=True, verbose_name='Espaço usado (MB)')),
                ('monthly_traffic_mb', models.PositiveBigIntegerField(blank=True, null=True, verbose_name='Tráfego mensal (MB)')),
                ('email_account_limit', models.PositiveIntegerField(blank=True, null=True, verbose_name='Limite de emails')),
                ('php_version', models.CharField(blank=True, max_length=30, verbose_name='Versão PHP')),
                ('status', models.CharField(choices=[('active', 'Ativo'), ('suspended', 'Suspenso'), ('cancelled', 'Cancelado'), ('migrating', 'Em migração'), ('unknown', 'Por confirmar')], default='active', max_length=20, verbose_name='Estado do alojamento')),
                ('notes', models.TextField(blank=True, verbose_name='Notas')),
                ('history_id', models.AutoField(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)),
                ('primary_domain', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='domains.domain', verbose_name='Domínio principal')),
                ('server', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='technical.server', verbose_name='Servidor')),
                ('service', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='services.service', verbose_name='Serviço')),
            ],
            options={
                'verbose_name': 'historical Alojamento',
                'verbose_name_plural': 'historical Alojamentos',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': ('history_date', 'history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HostingAccount',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('public_id', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Criado em')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Atualizado em')),
                ('plan_name', models.CharField(blank=True, max_length=120, verbose_name='Plano')),
                ('panel_type', models.CharField(choices=[('cpanel', 'cPanel'), ('plesk', 'Plesk'), ('directadmin', 'DirectAdmin'), ('custom', 'Personalizado'), ('none', 'Sem painel')], default='cpanel', max_length=20, verbose_name='Painel')),
                ('account_reference', models.CharField(blank=True, help_text='Identificador ou referência no cofre; nunca guardar a password.', max_length=150, verbose_name='Referência da conta')),
                ('document_root', models.CharField(blank=True, max_length=500, verbose_name='Pasta principal')),
                ('disk_quota_mb', models.PositiveBigIntegerField(blank=True, null=True, verbose_name='Espaço contratado (MB)')),
                ('disk_used_mb', models.PositiveBigIntegerField(blank=True, null=True, verbose_name='Espaço usado (MB)')),
                ('monthly_traffic_mb', models.PositiveBigIntegerField(blank=True, null=True, verbose_name='Tráfego mensal (MB)')),
                ('email_account_limit', models.PositiveIntegerField(blank=True, null=True, verbose_name='Limite de emails')),
                ('php_version', models.CharField(blank=True, max_length=30, verbose_name='Versão PHP')),
                ('status', models.CharField(choices=[('active', 'Ativo'), ('suspended', 'Suspenso'), ('cancelled', 'Cancelado'), ('migrating', 'Em migração'), ('unknown', 'Por confirmar')], default='active', max_length=20, verbose_name='Estado do alojamento')),
                ('notes', models.TextField(blank=True, verbose_name='Notas')),
                ('primary_domain', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='hosting_accounts', to='domains.domain', verbose_name='Domínio principal')),
                ('server', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='hosting_accounts', to='technical.server', verbose_name='Servidor')),
                ('service', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='hosting_details', to='services.service', verbose_name='Serviço')),
            ],
            options={
                'verbose_name': 'Alojamento',
                'verbose_name_plural': 'Alojamentos',
                'ordering': ['service__client__name', 'service__name'],
            },
        ),
    ]
