# Generated by Django 5.2.8 on 2025-12-06 15:03

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("odoo", "0002_initial"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name="odooemployee",
            name="user",
            field=models.OneToOneField(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AddField(
            model_name="odoochatbridge",
            name="profile",
            field=models.ForeignKey(
                help_text="Verified Odoo employee credentials used to post chat messages.",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="chat_bridges",
                to="odoo.odooemployee",
            ),
        ),
        migrations.AddConstraint(
            model_name="odooemployee",
            constraint=models.CheckConstraint(
                condition=models.Q(
                    ("avatar__isnull", True),
                    models.Q(
                        ("avatar__isnull", False),
                        ("user__isnull", True),
                        ("group__isnull", True),
                    ),
                    _connector="OR",
                ),
                name="odooemployee_avatar_exclusive",
            ),
        ),
        migrations.AddConstraint(
            model_name="odoochatbridge",
            constraint=models.UniqueConstraint(
                condition=models.Q(("site__isnull", False)),
                fields=("site",),
                name="unique_odoo_chat_bridge_site",
            ),
        ),
        migrations.AddConstraint(
            model_name="odoochatbridge",
            constraint=models.UniqueConstraint(
                condition=models.Q(("is_default", True)),
                fields=("is_default",),
                name="single_default_odoo_chat_bridge",
            ),
        ),
    ]
