# Generated by Django 6.0.5 on 2026-05-25 19:47

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('core', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Deal',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('code', models.CharField(db_index=True, max_length=10, unique=True)),
                ('title', models.CharField(max_length=200)),
                ('description', models.TextField()),
                ('amount', models.DecimalField(decimal_places=2, max_digits=15)),
                ('fee', models.DecimalField(decimal_places=2, max_digits=15)),
                ('net_amount', models.DecimalField(decimal_places=2, max_digits=15)),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('awaiting_payment', 'Awaiting Payment'), ('funded', 'Funded'), ('in_transit', 'In Transit'), ('confirming', 'Confirming'), ('completed', 'Completed'), ('disputed', 'Disputed'), ('cancelled', 'Cancelled'), ('refunded', 'Refunded')], db_index=True, max_length=20)),
                ('inspection_window_hours', models.PositiveSmallIntegerField(default=72)),
                ('funded_at', models.DateTimeField(blank=True, null=True)),
                ('shipped_at', models.DateTimeField(blank=True, null=True)),
                ('confirmed_at', models.DateTimeField(blank=True, null=True)),
                ('auto_release_at', models.DateTimeField(blank=True, null=True)),
                ('tracking_info', models.CharField(blank=True, max_length=100, null=True)),
                ('has_dispute', models.BooleanField(default=False)),
                ('buyer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='buyer_deals', to='core.user')),
                ('seller', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='seller_deals', to='core.user')),
            ],
            options={
                'db_table': 'deals',
            },
        ),
    ]
