# Generated by Django 4.2.25 on 2025-11-26 21:07

from django.db import migrations, models
import django.db.models.deletion
import home.utils


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('login', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='DocumentoPDF',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('archivo', models.FileField(max_length=255, upload_to=home.utils.GeneradorRutaArchivo('documentos_pdf'), verbose_name='Archivo PDF')),
                ('tipo', models.CharField(choices=[('DESCARGO', 'Descargo de Responsabilidad'), ('DIAGNOSTICO', 'Diagnóstico Técnico'), ('OTRO', 'Otro Documento')], default='DESCARGO', max_length=20, verbose_name='Tipo de Documento')),
                ('fecha_creacion', models.DateTimeField(auto_now_add=True)),
                ('descripcion', models.CharField(blank=True, max_length=255, null=True)),
                ('usuario', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='mis_documentos', to='login.usuario', verbose_name='Usuario Propietario')),
            ],
            options={
                'verbose_name': 'Documento PDF',
                'verbose_name_plural': 'Historial de Documentos PDF',
                'db_table': 'documentos_pdf',
                'ordering': ['-fecha_creacion'],
            },
        ),
        migrations.CreateModel(
            name='Ubicacion',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre', models.CharField(max_length=255, verbose_name='Nombre de la Zona')),
                ('codigo_qr', models.CharField(max_length=100, unique=True, verbose_name='Código QR (Asset Tag)')),
                ('ciudad', models.CharField(blank=True, max_length=100, null=True)),
                ('freshservice_id', models.BigIntegerField(unique=True, verbose_name='ID Freshservice')),
                ('descripcion', models.TextField(blank=True, null=True)),
                ('activa', models.BooleanField(default=True)),
                ('fecha_actualizacion', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'Ubicación / Zona Crítica',
                'verbose_name_plural': 'Ubicaciones',
                'db_table': 'ubicaciones',
            },
        ),
        migrations.CreateModel(
            name='RegistroIngreso',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('fecha_hora_ingreso', models.DateTimeField(auto_now_add=True)),
                ('fecha_hora_salida', models.DateTimeField(blank=True, null=True)),
                ('firma_visitante', models.ImageField(upload_to=home.utils.GeneradorRutaArchivo('firmas/visitantes'))),
                ('firma_responsable', models.ImageField(upload_to=home.utils.GeneradorRutaArchivo('firmas/responsables'))),
                ('acepta_descargo', models.BooleanField(default=True)),
                ('acepta_politicas', models.BooleanField(default=True)),
                ('ingresa_equipos', models.CharField(choices=[('SI', 'Sí'), ('NO', 'No')], default='NO', max_length=5)),
                ('estado', models.CharField(choices=[('Pendiente', 'Pendiente Registro Herramientas'), ('En Zona', 'En Zona'), ('Finalizado', 'Finalizado')], default='En Zona', max_length=20)),
                ('documento_asociado', models.ForeignKey(blank=True, db_column='id_documento_pdf', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='ingreso_origen', to='descargo_responsabilidad.documentopdf', verbose_name='PDF Firmado')),
                ('responsable', models.ForeignKey(db_column='id_responsable', on_delete=django.db.models.deletion.PROTECT, related_name='autorizaciones_responsable', to='login.usuario')),
                ('ubicacion', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='registros_historial', to='descargo_responsabilidad.ubicacion', verbose_name='Zona Crítica')),
                ('visitante', models.ForeignKey(db_column='id_visitante', on_delete=django.db.models.deletion.PROTECT, related_name='ingresos_visitante', to='login.usuario')),
            ],
            options={
                'db_table': 'registros_ingreso',
            },
        ),
    ]
