# Generated by Django 6.0.7 on 2026-07-23 12:44

import django.db.models.deletion
import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("customer", "__first__"),
        ("language", "0001_initial"),
        ("sites", "0002_alter_domain_unique"),
    ]

    operations = [
        migrations.CreateModel(
            name="Banner",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        primary_key=True,
                        serialize=False,
                        unique=True,
                        verbose_name="model.field.id",
                    ),
                ),
                (
                    "token",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        unique=True,
                        verbose_name="model.field.token",
                    ),
                ),
                (
                    "title",
                    models.CharField(max_length=255, verbose_name="model.field.title"),
                ),
                (
                    "image",
                    models.ImageField(
                        upload_to="images/banner/%Y/%m/%d",
                        verbose_name="model.field.image",
                    ),
                ),
                (
                    "link",
                    models.URLField(
                        blank=True,
                        max_length=255,
                        null=True,
                        verbose_name="model.field.link",
                    ),
                ),
                (
                    "target_blank",
                    models.BooleanField(
                        default=False, verbose_name="model.field.target-blank"
                    ),
                ),
                (
                    "zone",
                    models.CharField(
                        choices=[
                            ("home", "enum.banner-zone.home"),
                            ("signin", "enum.banner-zone.signin"),
                            ("signup", "enum.banner-zone.signup"),
                        ],
                        max_length=50,
                        verbose_name="model.field.zone",
                    ),
                ),
                (
                    "sort_order",
                    models.IntegerField(
                        default=0, verbose_name="model.field.sort-order"
                    ),
                ),
                (
                    "start_at",
                    models.DateTimeField(
                        blank=True, null=True, verbose_name="model.field.start-at"
                    ),
                ),
                (
                    "end_at",
                    models.DateTimeField(
                        blank=True, null=True, verbose_name="model.field.end-at"
                    ),
                ),
                (
                    "active",
                    models.BooleanField(
                        default=True, verbose_name="model.field.active"
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        auto_now_add=True, verbose_name="model.field.created-at"
                    ),
                ),
                (
                    "updated_at",
                    models.DateTimeField(
                        auto_now=True, verbose_name="model.field.updated-at"
                    ),
                ),
                (
                    "language",
                    models.ForeignKey(
                        blank=True,
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.RESTRICT,
                        to="language.language",
                        verbose_name="model.field.language",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="banners",
                        to="sites.site",
                        verbose_name="model.field.site",
                    ),
                ),
            ],
            options={
                "verbose_name": "model.banner.name",
                "verbose_name_plural": "model.banner.name.plural",
                "db_table": "banner",
            },
        ),
        migrations.CreateModel(
            name="BannerAccess",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        primary_key=True,
                        serialize=False,
                        unique=True,
                        verbose_name="model.field.id",
                    ),
                ),
                (
                    "access_type",
                    models.CharField(
                        choices=[
                            ("view", "enum.banner-access-type.view"),
                            ("click", "enum.banner-access-type.click"),
                        ],
                        max_length=25,
                        verbose_name="model.field.access-type",
                    ),
                ),
                (
                    "ip_address",
                    models.GenericIPAddressField(verbose_name="model.field.ip"),
                ),
                (
                    "country_code",
                    models.CharField(
                        blank=True,
                        help_text="model.field.country-code.help",
                        max_length=2,
                        null=True,
                        verbose_name="model.field.country-code",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        auto_now_add=True, verbose_name="model.field.created-at"
                    ),
                ),
                (
                    "banner",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="accesses",
                        to="banner.banner",
                        verbose_name="model.field.banner",
                    ),
                ),
                (
                    "customer",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="banner_accesses",
                        to="customer.customer",
                        verbose_name="model.field.customer",
                    ),
                ),
            ],
            options={
                "verbose_name": "model.banner-access.name",
                "verbose_name_plural": "model.banner-access.name.plural",
                "db_table": "banner_access",
            },
        ),
        migrations.AddIndex(
            model_name="banner",
            index=models.Index(fields=["title"], name="banner_title"),
        ),
        migrations.AddIndex(
            model_name="banner",
            index=models.Index(fields=["token"], name="banner_token"),
        ),
        migrations.AddIndex(
            model_name="banner",
            index=models.Index(fields=["zone"], name="banner_zone"),
        ),
        migrations.AddIndex(
            model_name="banner",
            index=models.Index(fields=["sort_order"], name="banner_sort_order"),
        ),
        migrations.AddIndex(
            model_name="banner",
            index=models.Index(fields=["active"], name="banner_active"),
        ),
        migrations.AddIndex(
            model_name="banner",
            index=models.Index(fields=["start_at"], name="banner_start_at"),
        ),
        migrations.AddIndex(
            model_name="banner",
            index=models.Index(fields=["end_at"], name="banner_end_at"),
        ),
        migrations.AddIndex(
            model_name="banner",
            index=models.Index(fields=["created_at"], name="banner_created_at"),
        ),
        migrations.AddIndex(
            model_name="banneraccess",
            index=models.Index(fields=["ip_address"], name="banner_access_ip_address"),
        ),
        migrations.AddIndex(
            model_name="banneraccess",
            index=models.Index(
                fields=["country_code"], name="banner_access_country_code"
            ),
        ),
        migrations.AddIndex(
            model_name="banneraccess",
            index=models.Index(
                fields=["access_type"], name="banner_access_access_type"
            ),
        ),
        migrations.AddIndex(
            model_name="banneraccess",
            index=models.Index(fields=["created_at"], name="banner_access_created_at"),
        ),
    ]
