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

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='HistoricalWebsiteProject',
            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')),
                ('title', models.CharField(max_length=180, verbose_name='Projeto')),
                ('status', models.CharField(choices=[('quote', 'Em orçamento'), ('approved', 'Aprovado'), ('development', 'Em desenvolvimento'), ('waiting', 'A aguardar cliente'), ('delivered', 'Entregue'), ('paid', 'Pago'), ('partial', 'Parcialmente pago'), ('maintenance', 'Em manutenção'), ('cancelled', 'Cancelado'), ('archived', 'Arquivado')], db_index=True, default='quote', max_length=20, verbose_name='Estado')),
                ('start_date', models.DateField(blank=True, null=True, verbose_name='Data de início')),
                ('delivery_date', models.DateField(blank=True, null=True, verbose_name='Data de entrega')),
                ('contracted_value', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=12, verbose_name='Valor contratado')),
                ('historical_received_value', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=12, verbose_name='Valor recebido (histórico)')),
                ('partner', models.CharField(blank=True, max_length=150, verbose_name='Parceiro')),
                ('theme_name', models.CharField(blank=True, max_length=150, verbose_name='Tema / template')),
                ('technology', models.CharField(blank=True, help_text='Ex.: WordPress, Django, HTML/CSS', max_length=150, verbose_name='Tecnologia')),
                ('repository_reference', models.CharField(blank=True, max_length=250, verbose_name='Referência do repositório')),
                ('notes', models.TextField(blank=True, verbose_name='Observações')),
                ('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)),
                ('client', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='clients.client', verbose_name='Cliente')),
                ('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')),
            ],
            options={
                'verbose_name': 'historical Projeto web',
                'verbose_name_plural': 'historical Projetos web',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': ('history_date', 'history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='WebsiteProject',
            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')),
                ('title', models.CharField(max_length=180, verbose_name='Projeto')),
                ('status', models.CharField(choices=[('quote', 'Em orçamento'), ('approved', 'Aprovado'), ('development', 'Em desenvolvimento'), ('waiting', 'A aguardar cliente'), ('delivered', 'Entregue'), ('paid', 'Pago'), ('partial', 'Parcialmente pago'), ('maintenance', 'Em manutenção'), ('cancelled', 'Cancelado'), ('archived', 'Arquivado')], db_index=True, default='quote', max_length=20, verbose_name='Estado')),
                ('start_date', models.DateField(blank=True, null=True, verbose_name='Data de início')),
                ('delivery_date', models.DateField(blank=True, null=True, verbose_name='Data de entrega')),
                ('contracted_value', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=12, verbose_name='Valor contratado')),
                ('historical_received_value', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=12, verbose_name='Valor recebido (histórico)')),
                ('partner', models.CharField(blank=True, max_length=150, verbose_name='Parceiro')),
                ('theme_name', models.CharField(blank=True, max_length=150, verbose_name='Tema / template')),
                ('technology', models.CharField(blank=True, help_text='Ex.: WordPress, Django, HTML/CSS', max_length=150, verbose_name='Tecnologia')),
                ('repository_reference', models.CharField(blank=True, max_length=250, verbose_name='Referência do repositório')),
                ('notes', models.TextField(blank=True, verbose_name='Observações')),
                ('client', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='website_projects', to='clients.client', verbose_name='Cliente')),
                ('primary_domain', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='website_projects', to='domains.domain', verbose_name='Domínio principal')),
                ('recurring_services', models.ManyToManyField(blank=True, related_name='website_projects', to='services.service', verbose_name='Serviços recorrentes associados')),
            ],
            options={
                'verbose_name': 'Projeto web',
                'verbose_name_plural': 'Projetos web',
                'ordering': ['-start_date', 'title'],
            },
        ),
    ]
