# Generated by Django 4.1.3 on 2023-05-25 13:58

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("Sistemas", "0019_alter_device_options"),
        ("authtoken", "0003_tokenproxy"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="ClientesA24",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("RFC", models.CharField(max_length=13, unique=True)),
                ("Nombre", models.CharField(max_length=100)),
                ("Activo", models.BooleanField(default=False)),
                ("fecha_baja", models.DateField(blank=True, null=True)),
            ],
            options={
                "ordering": ("-Activo", "RFC"),
            },
        ),
        migrations.CreateModel(
            name="DeviceA24",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("deviceName", models.CharField(max_length=255)),
                ("deviceOS", models.CharField(max_length=255)),
                ("deviceIP", models.GenericIPAddressField()),
                ("MAC", models.CharField(blank=True, max_length=30, null=True)),
                ("dataBase", models.CharField(blank=True, max_length=40, null=True)),
                ("timestamp", models.DateTimeField(auto_now_add=True)),
                (
                    "clienteA24",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="IMMEX.clientesa24",
                    ),
                ),
                (
                    "sistema",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="Sistemas.sistema",
                    ),
                ),
                (
                    "token",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="authtoken.token",
                    ),
                ),
                (
                    "username",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "ordering": ("username",),
            },
        ),
        migrations.CreateModel(
            name="Sistemas_por_cliente_A24",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("num_licencias", models.IntegerField(default=1)),
                (
                    "cliente",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="cliente_spc_IMMEX",
                        to="IMMEX.clientesa24",
                    ),
                ),
                (
                    "id_sistema",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="sistema_spc_IMMEX",
                        to="Sistemas.sistema",
                    ),
                ),
            ],
            options={
                "ordering": ("-cliente", "id_sistema"),
                "unique_together": {("id_sistema", "cliente")},
            },
        ),
    ]
