# Generated by Django 4.2.30 on 2026-06-12 21:41

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Device',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('organization_id', models.IntegerField(blank=True, null=True)),
                ('device_id', models.CharField(max_length=190, unique=True)),
                ('label', models.CharField(blank=True, max_length=120)),
                ('push_token', models.CharField(blank=True, max_length=512)),
                ('platform', models.CharField(blank=True, max_length=20)),
                ('is_sms_gateway', models.BooleanField(default=False)),
                ('active', models.BooleanField(default=True)),
                ('last_seen', models.DateTimeField(blank=True, null=True)),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now)),
            ],
        ),
        migrations.CreateModel(
            name='NotificationEvent',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('organization_id', models.IntegerField(blank=True, null=True)),
                ('event', models.CharField(default='new_email', max_length=40)),
                ('mailbox', models.CharField(blank=True, max_length=190)),
                ('mailbox_id', models.IntegerField(blank=True, null=True)),
                ('sender', models.CharField(blank=True, max_length=320)),
                ('subject', models.CharField(blank=True, max_length=500)),
                ('preview', models.CharField(blank=True, max_length=200)),
                ('source_ref', models.CharField(blank=True, max_length=64)),
                ('payload', models.JSONField(blank=True, default=dict)),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now)),
            ],
            options={
                'ordering': ('-created_at',),
            },
        ),
        migrations.CreateModel(
            name='OutboundSms',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('organization_id', models.IntegerField(blank=True, null=True)),
                ('to_number', models.CharField(max_length=32)),
                ('body', models.TextField()),
                ('status', models.CharField(choices=[('queued', 'Queued'), ('picked', 'Picked'), ('sent', 'Sent'), ('failed', 'Failed')], default='queued', max_length=12)),
                ('backend', models.CharField(blank=True, max_length=20)),
                ('provider_sid', models.CharField(blank=True, max_length=64)),
                ('error', models.TextField(blank=True)),
                ('attempts', models.PositiveSmallIntegerField(default=0)),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now)),
                ('sent_at', models.DateTimeField(blank=True, null=True)),
                ('device', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sms_jobs', to='notifications.device')),
                ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sms', to='notifications.notificationevent')),
            ],
            options={
                'ordering': ('-created_at',),
            },
        ),
    ]
