# Generated by Django 5.2.5 on 2025-08-15 20:06

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='VideoStream',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('source_type', models.CharField(choices=[('rtmp', 'RTMP Stream'), ('file', 'File Upload'), ('url', 'External URL'), ('webcam', 'Local Webcam')], default='rtmp', max_length=20)),
                ('source_url', models.URLField(blank=True, null=True)),
                ('source_file', models.FileField(blank=True, null=True, upload_to='uploads/')),
                ('processing_mode', models.CharField(choices=[('live', 'Live Processing'), ('batch', 'Batch Processing')], default='live', max_length=20)),
                ('status', models.CharField(choices=[('inactive', 'Inactive'), ('starting', 'Starting'), ('active', 'Active'), ('stopping', 'Stopping'), ('error', 'Error')], default='inactive', max_length=20)),
                ('stream_key', models.CharField(max_length=64, unique=True)),
                ('hls_playlist_url', models.URLField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='MediaSegment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sequence_number', models.PositiveIntegerField()),
                ('file_path', models.CharField(max_length=500)),
                ('duration', models.FloatField()),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('processed', models.BooleanField(default=False)),
                ('stream', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='segments', to='streaming.videostream')),
            ],
            options={
                'ordering': ['stream', 'sequence_number'],
                'unique_together': {('stream', 'sequence_number')},
            },
        ),
    ]
