# Generated by Django 5.2.15 on 2026-06-16 09:07

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):

    dependencies = [
        ('technical', '0002_alter_backuprecord_status_and_more'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='HistoricalSSLCertificate',
            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')),
                ('primary_domain', models.CharField(db_index=True, max_length=253, verbose_name='Domínio principal')),
                ('covered_domains', models.TextField(blank=True, help_text='Um domínio por linha.', verbose_name='Domínios abrangidos')),
                ('issuer', models.CharField(blank=True, max_length=180, verbose_name='Emissor')),
                ('certificate_type', models.CharField(choices=[('lets_encrypt', "Let's Encrypt"), ('commercial', 'Comercial'), ('cloudflare', 'Cloudflare'), ('self_signed', 'Autoassinado'), ('other', 'Outro')], default='lets_encrypt', max_length=20, verbose_name='Tipo')),
                ('issued_at', models.DateTimeField(blank=True, null=True, verbose_name='Emitido em')),
                ('expires_at', models.DateTimeField(blank=True, db_index=True, null=True, verbose_name='Expira em')),
                ('automatic_renewal', models.BooleanField(default=True, verbose_name='Renovação automática')),
                ('validation_method', models.CharField(choices=[('http', 'HTTP'), ('dns', 'DNS'), ('email', 'Email'), ('managed', 'Gerido pelo fornecedor'), ('unknown', 'Por confirmar')], default='managed', max_length=20, verbose_name='Validação')),
                ('status', models.CharField(choices=[('pending', 'Pendente'), ('valid', 'Válido'), ('expiring', 'A expirar'), ('expired', 'Expirado'), ('invalid', 'Inválido'), ('revoked', 'Revogado'), ('unknown', 'Por verificar')], db_index=True, default='unknown', max_length=20, verbose_name='Estado')),
                ('last_checked_at', models.DateTimeField(blank=True, null=True, verbose_name='Última verificação')),
                ('error_message', models.TextField(blank=True, verbose_name='Último erro')),
                ('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)),
                ('technical_asset', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='technical.technicalasset', verbose_name='Ativo técnico')),
            ],
            options={
                'verbose_name': 'historical Certificado SSL',
                'verbose_name_plural': 'historical Certificados SSL',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': ('history_date', 'history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalWordPressSite',
            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')),
                ('public_url', models.URLField(blank=True, verbose_name='URL pública')),
                ('admin_url', models.URLField(blank=True, verbose_name='URL de administração')),
                ('installed_version', models.CharField(blank=True, max_length=30, verbose_name='Versão instalada')),
                ('available_version', models.CharField(blank=True, max_length=30, verbose_name='Versão disponível')),
                ('php_version', models.CharField(blank=True, max_length=30, verbose_name='Versão PHP')),
                ('multisite', models.BooleanField(default=False, verbose_name='WordPress Multisite')),
                ('wp_cron_enabled', models.BooleanField(default=True, verbose_name='WP-Cron ativo')),
                ('automatic_core_updates', models.BooleanField(default=False, verbose_name='Atualizações automáticas do núcleo')),
                ('debug_mode', models.BooleanField(default=False, verbose_name='WP_DEBUG ativo')),
                ('maintenance_mode', models.BooleanField(default=False, verbose_name='Modo de manutenção')),
                ('credentials_reference', models.CharField(blank=True, help_text='Indique apenas a referência do cofre; nunca guarde palavras-passe.', max_length=180, verbose_name='Referência das credenciais')),
                ('health_status', models.CharField(choices=[('healthy', 'Saudável'), ('attention', 'Requer atenção'), ('critical', 'Crítico'), ('maintenance', 'Em manutenção'), ('unknown', 'Por verificar')], db_index=True, default='unknown', max_length=20, verbose_name='Estado de saúde')),
                ('last_updated_at', models.DateTimeField(blank=True, null=True, verbose_name='Última atualização')),
                ('last_scan_at', models.DateTimeField(blank=True, null=True, verbose_name='Última análise')),
                ('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)),
                ('technical_asset', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='technical.technicalasset', verbose_name='Ativo técnico')),
            ],
            options={
                'verbose_name': 'historical Site WordPress',
                'verbose_name_plural': 'historical Sites WordPress',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': ('history_date', 'history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='SSLCertificate',
            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')),
                ('primary_domain', models.CharField(db_index=True, max_length=253, verbose_name='Domínio principal')),
                ('covered_domains', models.TextField(blank=True, help_text='Um domínio por linha.', verbose_name='Domínios abrangidos')),
                ('issuer', models.CharField(blank=True, max_length=180, verbose_name='Emissor')),
                ('certificate_type', models.CharField(choices=[('lets_encrypt', "Let's Encrypt"), ('commercial', 'Comercial'), ('cloudflare', 'Cloudflare'), ('self_signed', 'Autoassinado'), ('other', 'Outro')], default='lets_encrypt', max_length=20, verbose_name='Tipo')),
                ('issued_at', models.DateTimeField(blank=True, null=True, verbose_name='Emitido em')),
                ('expires_at', models.DateTimeField(blank=True, db_index=True, null=True, verbose_name='Expira em')),
                ('automatic_renewal', models.BooleanField(default=True, verbose_name='Renovação automática')),
                ('validation_method', models.CharField(choices=[('http', 'HTTP'), ('dns', 'DNS'), ('email', 'Email'), ('managed', 'Gerido pelo fornecedor'), ('unknown', 'Por confirmar')], default='managed', max_length=20, verbose_name='Validação')),
                ('status', models.CharField(choices=[('pending', 'Pendente'), ('valid', 'Válido'), ('expiring', 'A expirar'), ('expired', 'Expirado'), ('invalid', 'Inválido'), ('revoked', 'Revogado'), ('unknown', 'Por verificar')], db_index=True, default='unknown', max_length=20, verbose_name='Estado')),
                ('last_checked_at', models.DateTimeField(blank=True, null=True, verbose_name='Última verificação')),
                ('error_message', models.TextField(blank=True, verbose_name='Último erro')),
                ('notes', models.TextField(blank=True, verbose_name='Notas')),
                ('technical_asset', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='ssl_certificate', to='technical.technicalasset', verbose_name='Ativo técnico')),
            ],
            options={
                'verbose_name': 'Certificado SSL',
                'verbose_name_plural': 'Certificados SSL',
                'ordering': ['expires_at', 'primary_domain'],
            },
        ),
        migrations.CreateModel(
            name='WordPressSite',
            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')),
                ('public_url', models.URLField(blank=True, verbose_name='URL pública')),
                ('admin_url', models.URLField(blank=True, verbose_name='URL de administração')),
                ('installed_version', models.CharField(blank=True, max_length=30, verbose_name='Versão instalada')),
                ('available_version', models.CharField(blank=True, max_length=30, verbose_name='Versão disponível')),
                ('php_version', models.CharField(blank=True, max_length=30, verbose_name='Versão PHP')),
                ('multisite', models.BooleanField(default=False, verbose_name='WordPress Multisite')),
                ('wp_cron_enabled', models.BooleanField(default=True, verbose_name='WP-Cron ativo')),
                ('automatic_core_updates', models.BooleanField(default=False, verbose_name='Atualizações automáticas do núcleo')),
                ('debug_mode', models.BooleanField(default=False, verbose_name='WP_DEBUG ativo')),
                ('maintenance_mode', models.BooleanField(default=False, verbose_name='Modo de manutenção')),
                ('credentials_reference', models.CharField(blank=True, help_text='Indique apenas a referência do cofre; nunca guarde palavras-passe.', max_length=180, verbose_name='Referência das credenciais')),
                ('health_status', models.CharField(choices=[('healthy', 'Saudável'), ('attention', 'Requer atenção'), ('critical', 'Crítico'), ('maintenance', 'Em manutenção'), ('unknown', 'Por verificar')], db_index=True, default='unknown', max_length=20, verbose_name='Estado de saúde')),
                ('last_updated_at', models.DateTimeField(blank=True, null=True, verbose_name='Última atualização')),
                ('last_scan_at', models.DateTimeField(blank=True, null=True, verbose_name='Última análise')),
                ('notes', models.TextField(blank=True, verbose_name='Notas')),
                ('technical_asset', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='wordpress_site', to='technical.technicalasset', verbose_name='Ativo técnico')),
            ],
            options={
                'verbose_name': 'Site WordPress',
                'verbose_name_plural': 'Sites WordPress',
                'ordering': ['technical_asset__service__client__name', 'technical_asset__label'],
            },
        ),
        migrations.CreateModel(
            name='HistoricalWordPressTheme',
            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')),
                ('name', models.CharField(max_length=180, verbose_name='Nome')),
                ('slug', models.SlugField(blank=True, max_length=180, verbose_name='Slug')),
                ('installed_version', models.CharField(blank=True, max_length=40, verbose_name='Versão instalada')),
                ('available_version', models.CharField(blank=True, max_length=40, verbose_name='Versão disponível')),
                ('is_active', models.BooleanField(db_index=True, default=False, verbose_name='Tema ativo')),
                ('is_child_theme', models.BooleanField(default=False, verbose_name='Tema filho')),
                ('parent_theme', models.CharField(blank=True, max_length=180, verbose_name='Tema principal')),
                ('automatic_updates', models.BooleanField(default=False, verbose_name='Atualização automática')),
                ('premium', models.BooleanField(default=False, verbose_name='Premium')),
                ('provider', models.CharField(blank=True, max_length=150, verbose_name='Fornecedor')),
                ('license_reference', models.CharField(blank=True, max_length=180, verbose_name='Referência da licença')),
                ('license_expires_on', models.DateField(blank=True, db_index=True, null=True, verbose_name='Licença válida até')),
                ('last_checked_at', models.DateTimeField(blank=True, null=True, verbose_name='Última verificação')),
                ('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)),
                ('wordpress_site', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='technical.wordpresssite', verbose_name='Site WordPress')),
            ],
            options={
                'verbose_name': 'historical Tema WordPress',
                'verbose_name_plural': 'historical Temas WordPress',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': ('history_date', 'history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalWordPressPlugin',
            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')),
                ('name', models.CharField(max_length=180, verbose_name='Nome')),
                ('slug', models.SlugField(blank=True, max_length=180, verbose_name='Slug')),
                ('installed_version', models.CharField(blank=True, max_length=40, verbose_name='Versão instalada')),
                ('available_version', models.CharField(blank=True, max_length=40, verbose_name='Versão disponível')),
                ('activation_status', models.CharField(choices=[('active', 'Ativo'), ('inactive', 'Inativo'), ('must_use', 'Must-use')], db_index=True, default='active', max_length=20, verbose_name='Estado')),
                ('automatic_updates', models.BooleanField(default=False, verbose_name='Atualização automática')),
                ('premium', models.BooleanField(default=False, verbose_name='Premium')),
                ('provider', models.CharField(blank=True, max_length=150, verbose_name='Fornecedor')),
                ('license_reference', models.CharField(blank=True, max_length=180, verbose_name='Referência da licença')),
                ('license_expires_on', models.DateField(blank=True, db_index=True, null=True, verbose_name='Licença válida até')),
                ('security_status', models.CharField(choices=[('secure', 'Sem alertas conhecidos'), ('attention', 'Requer atenção'), ('vulnerable', 'Vulnerável'), ('unknown', 'Por verificar')], db_index=True, default='unknown', max_length=20, verbose_name='Segurança')),
                ('last_checked_at', models.DateTimeField(blank=True, null=True, verbose_name='Última verificação')),
                ('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)),
                ('wordpress_site', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='technical.wordpresssite', verbose_name='Site WordPress')),
            ],
            options={
                'verbose_name': 'historical Plugin WordPress',
                'verbose_name_plural': 'historical Plugins WordPress',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': ('history_date', 'history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='WordPressPlugin',
            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')),
                ('name', models.CharField(max_length=180, verbose_name='Nome')),
                ('slug', models.SlugField(blank=True, max_length=180, verbose_name='Slug')),
                ('installed_version', models.CharField(blank=True, max_length=40, verbose_name='Versão instalada')),
                ('available_version', models.CharField(blank=True, max_length=40, verbose_name='Versão disponível')),
                ('activation_status', models.CharField(choices=[('active', 'Ativo'), ('inactive', 'Inativo'), ('must_use', 'Must-use')], db_index=True, default='active', max_length=20, verbose_name='Estado')),
                ('automatic_updates', models.BooleanField(default=False, verbose_name='Atualização automática')),
                ('premium', models.BooleanField(default=False, verbose_name='Premium')),
                ('provider', models.CharField(blank=True, max_length=150, verbose_name='Fornecedor')),
                ('license_reference', models.CharField(blank=True, max_length=180, verbose_name='Referência da licença')),
                ('license_expires_on', models.DateField(blank=True, db_index=True, null=True, verbose_name='Licença válida até')),
                ('security_status', models.CharField(choices=[('secure', 'Sem alertas conhecidos'), ('attention', 'Requer atenção'), ('vulnerable', 'Vulnerável'), ('unknown', 'Por verificar')], db_index=True, default='unknown', max_length=20, verbose_name='Segurança')),
                ('last_checked_at', models.DateTimeField(blank=True, null=True, verbose_name='Última verificação')),
                ('notes', models.TextField(blank=True, verbose_name='Notas')),
                ('wordpress_site', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='plugins', to='technical.wordpresssite', verbose_name='Site WordPress')),
            ],
            options={
                'verbose_name': 'Plugin WordPress',
                'verbose_name_plural': 'Plugins WordPress',
                'ordering': ['wordpress_site', 'name'],
                'constraints': [models.UniqueConstraint(fields=('wordpress_site', 'slug'), name='uniq_wordpress_plugin_slug_per_site')],
            },
        ),
        migrations.CreateModel(
            name='WordPressTheme',
            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')),
                ('name', models.CharField(max_length=180, verbose_name='Nome')),
                ('slug', models.SlugField(blank=True, max_length=180, verbose_name='Slug')),
                ('installed_version', models.CharField(blank=True, max_length=40, verbose_name='Versão instalada')),
                ('available_version', models.CharField(blank=True, max_length=40, verbose_name='Versão disponível')),
                ('is_active', models.BooleanField(db_index=True, default=False, verbose_name='Tema ativo')),
                ('is_child_theme', models.BooleanField(default=False, verbose_name='Tema filho')),
                ('parent_theme', models.CharField(blank=True, max_length=180, verbose_name='Tema principal')),
                ('automatic_updates', models.BooleanField(default=False, verbose_name='Atualização automática')),
                ('premium', models.BooleanField(default=False, verbose_name='Premium')),
                ('provider', models.CharField(blank=True, max_length=150, verbose_name='Fornecedor')),
                ('license_reference', models.CharField(blank=True, max_length=180, verbose_name='Referência da licença')),
                ('license_expires_on', models.DateField(blank=True, db_index=True, null=True, verbose_name='Licença válida até')),
                ('last_checked_at', models.DateTimeField(blank=True, null=True, verbose_name='Última verificação')),
                ('notes', models.TextField(blank=True, verbose_name='Notas')),
                ('wordpress_site', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='themes', to='technical.wordpresssite', verbose_name='Site WordPress')),
            ],
            options={
                'verbose_name': 'Tema WordPress',
                'verbose_name_plural': 'Temas WordPress',
                'ordering': ['wordpress_site', '-is_active', 'name'],
                'constraints': [models.UniqueConstraint(fields=('wordpress_site', 'slug'), name='uniq_wordpress_theme_slug_per_site')],
            },
        ),
    ]
