# Generated by Django 5.2.8 on 2025-11-27 02:59

import datetime
import django.core.validators
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Event',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200)),
                ('start_time', models.DateTimeField(db_index=True)),
                ('end_time', models.DateTimeField(db_index=True)),
                ('status', models.CharField(choices=[('SCHEDULED', 'Scheduled'), ('CANCELED', 'Canceled'), ('COMPLETED', 'Completed'), ('PAID', 'Paid')], db_index=True, default='SCHEDULED', max_length=20)),
                ('notes', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_events', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['start_time'],
            },
        ),
        migrations.CreateModel(
            name='Participant',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('role', models.CharField(choices=[('RESOURCE', 'Resource'), ('STAFF', 'Staff Member'), ('CUSTOMER', 'Customer'), ('OBSERVER', 'Observer')], default='CUSTOMER', max_length=20)),
                ('object_id', models.PositiveIntegerField()),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
                ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='participants', to='schedule.event')),
            ],
        ),
        migrations.CreateModel(
            name='Resource',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('description', models.TextField(blank=True)),
                ('max_concurrent_events', models.PositiveIntegerField(default=1, help_text='0=unlimited, 1=exclusive, >1=limited overlap', validators=[django.core.validators.MinValueValidator(0)])),
                ('buffer_duration', models.DurationField(default=datetime.timedelta(0), help_text='Time buffer before/after events. Buffers consume capacity.')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('is_active', models.BooleanField(default=True)),
            ],
            options={
                'ordering': ['name'],
                'indexes': [models.Index(fields=['is_active', 'name'], name='schedule_re_is_acti_36e127_idx')],
            },
        ),
        migrations.AddIndex(
            model_name='event',
            index=models.Index(fields=['start_time', 'end_time'], name='schedule_ev_start_t_355c00_idx'),
        ),
        migrations.AddIndex(
            model_name='event',
            index=models.Index(fields=['status', 'start_time'], name='schedule_ev_status_1ff12e_idx'),
        ),
        migrations.AddIndex(
            model_name='participant',
            index=models.Index(fields=['event', 'role'], name='schedule_pa_event_i_6b8287_idx'),
        ),
        migrations.AddIndex(
            model_name='participant',
            index=models.Index(fields=['content_type', 'object_id'], name='schedule_pa_content_51f2af_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='participant',
            unique_together={('event', 'content_type', 'object_id')},
        ),
    ]
