# Generated by Django 6.0 on 2026-01-08 12:53

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


class Migration(migrations.Migration):

    dependencies = [
        ('px_sources', '0004_simplify_pxsource_model'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='SourceUser',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('is_active', models.BooleanField(db_index=True, default=True, help_text='Whether this source user is active')),
                ('can_create_complaints', models.BooleanField(default=True, help_text='User can create complaints from this source')),
                ('can_create_inquiries', models.BooleanField(default=True, help_text='User can create inquiries from this source')),
                ('source', models.ForeignKey(help_text='Source managed by this user', on_delete=django.db.models.deletion.CASCADE, related_name='source_users', to='px_sources.pxsource')),
                ('user', models.OneToOneField(help_text='User who manages this source', on_delete=django.db.models.deletion.CASCADE, related_name='source_user_profile', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Source User',
                'verbose_name_plural': 'Source Users',
                'ordering': ['source__name_en'],
                'indexes': [models.Index(fields=['user', 'is_active'], name='px_sources__user_id_40a726_idx'), models.Index(fields=['source', 'is_active'], name='px_sources__source__eb51c5_idx')],
                'unique_together': {('user', 'source')},
            },
        ),
    ]
