# Generated by Django 5.2.17 on 2026-09-26 16:10

import django.core.validators
import django.db.models.deletion
import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('customers', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='CustomerAddress',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('label', models.CharField(blank=True, max_length=100)),
                ('is_primary', models.BooleanField(default=False)),
                ('is_active', models.BooleanField(default=True)),
                ('address_type', models.CharField(choices=[('HOME', 'Home'), ('WORK', 'Work'), ('BILLING', 'Billing'), ('SHIPPING', 'Shipping'), ('OTHER', 'Other')], max_length=8)),
                ('address_line_1', models.CharField(max_length=255)),
                ('address_line_2', models.CharField(blank=True, max_length=255)),
                ('area', models.CharField(blank=True, max_length=100)),
                ('city', models.CharField(max_length=100)),
                ('district', models.CharField(blank=True, max_length=100)),
                ('postal_code', models.CharField(blank=True, max_length=20)),
                ('country_code', models.CharField(max_length=2, validators=[django.core.validators.RegexValidator('\\A[A-Z]{2}\\Z', 'Use two ASCII letters.')])),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(class)s_records', to='customers.customer')),
            ],
            options={
                'ordering': ['created_at', 'id'],
                'abstract': False,
                'constraints': [models.CheckConstraint(condition=models.Q(('is_primary', False), ('is_active', True), _connector='OR'), name='customeraddress_primary_active'), models.CheckConstraint(condition=models.Q(('address_type__in', ['HOME', 'WORK', 'BILLING', 'SHIPPING', 'OTHER'])), name='customeraddress_type_valid'), models.CheckConstraint(condition=models.Q(('country_code__regex', '^[A-Z]{2}$')), name='customeraddress_country_format'), models.CheckConstraint(condition=models.Q(models.Q(('address_line_1', ''), _negated=True), models.Q(('city', ''), _negated=True)), name='customeraddress_required_text'), models.UniqueConstraint(condition=models.Q(('is_active', True), ('is_primary', True)), fields=('customer',), name='customeraddress_active_primary_uniq')],
            },
        ),
        migrations.CreateModel(
            name='CustomerContact',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('label', models.CharField(blank=True, max_length=100)),
                ('is_primary', models.BooleanField(default=False)),
                ('is_active', models.BooleanField(default=True)),
                ('contact_type', models.CharField(choices=[('MOBILE', 'Mobile'), ('PHONE', 'Phone'), ('EMAIL', 'Email'), ('WHATSAPP', 'WhatsApp'), ('OTHER', 'Other')], max_length=8)),
                ('value', models.CharField(max_length=254)),
                ('normalized_value', models.CharField(editable=False, max_length=254)),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='%(class)s_records', to='customers.customer')),
            ],
            options={
                'ordering': ['created_at', 'id'],
                'abstract': False,
                'constraints': [models.CheckConstraint(condition=models.Q(('is_primary', False), ('is_active', True), _connector='OR'), name='customercontact_primary_active'), models.CheckConstraint(condition=models.Q(('contact_type__in', ['MOBILE', 'PHONE', 'EMAIL', 'WHATSAPP', 'OTHER'])), name='customercontact_type_valid'), models.CheckConstraint(condition=models.Q(models.Q(('value', ''), _negated=True), models.Q(('normalized_value', ''), _negated=True)), name='customercontact_required_value'), models.UniqueConstraint(condition=models.Q(('is_active', True), ('is_primary', True)), fields=('customer', 'contact_type'), name='customercontact_active_primary_uniq'), models.UniqueConstraint(condition=models.Q(('is_active', True)), fields=('customer', 'contact_type', 'normalized_value'), name='customercontact_active_value_uniq')],
            },
        ),
    ]
