# Generated by Django 6.0.6 on 2026-10-13 14:30

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('organizations', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Customer',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('kind', models.CharField(choices=[('person', 'person'), ('company', 'company')], default='person', max_length=10)),
                ('status', models.CharField(choices=[('lead', 'lead'), ('active', 'active'), ('inactive', 'inactive')], default='lead', max_length=10)),
                ('phone', models.CharField(blank=True, default='', max_length=30)),
                ('email', models.CharField(blank=True, default='', max_length=200)),
                ('address', models.CharField(blank=True, default='', max_length=300)),
                ('notes', models.TextField(blank=True, default='')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='customers_created', to=settings.AUTH_USER_MODEL)),
                ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='customers', to='organizations.organization')),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='customers_owned', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created_at', '-id'],
            },
        ),
        migrations.CreateModel(
            name='Interaction',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('type', models.CharField(choices=[('call', 'call'), ('meeting', 'meeting'), ('email', 'email'), ('note', 'note')], default='note', max_length=10)),
                ('summary', models.TextField()),
                ('occurred_on', models.DateField()),
                ('follow_up_on', models.DateField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='interactions', to='crm.customer')),
                ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='interactions', to='organizations.organization')),
            ],
            options={
                'ordering': ['-occurred_on', '-id'],
            },
        ),
        migrations.AddIndex(
            model_name='customer',
            index=models.Index(fields=['organization', 'status'], name='crm_custome_organiz_3de5fb_idx'),
        ),
    ]
