# Generated by Django 4.2.15 on 2025-07-13 22:10

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Channel',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Date and time when the record was created', verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Date and time when the record was last updated', verbose_name='Updated At')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Unique identifier for this record', primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False, help_text='Whether this record has been soft deleted', verbose_name='Is Deleted')),
                ('deleted_at', models.DateTimeField(blank=True, help_text='Date and time when the record was deleted', null=True, verbose_name='Deleted At')),
                ('name', models.CharField(help_text='Full name of the TV channel', max_length=200, verbose_name='Channel Name')),
                ('display_name', models.CharField(help_text='Official call sign or identifier (e.g., "WABC-TV", "ESPN")', max_length=20, unique=True, verbose_name='Call Sign')),
                ('channel_number', models.CharField(help_text='Channel number on cable/satellite systems (e.g., "7.1", "ESPN")', max_length=20, verbose_name='Channel Number')),
                ('channel_type', models.CharField(choices=[('terrestrial', 'Terrestrial/Over-the-Air'), ('cable', 'Cable Channel'), ('satellite', 'Satellite Channel'), ('iptv', 'IPTV Channel'), ('streaming', 'Streaming Channel'), ('radio', 'Radio Station')], default='satellite', help_text='Type of broadcasting technology', max_length=20, verbose_name='Channel Type')),
                ('status', models.CharField(choices=[('active', 'Active'), ('inactive', 'Inactive'), ('maintenance', 'Maintenance'), ('testing', 'Testing')], default='active', help_text='Current status of the channel (e.g., Active, Inactive, Maintenance)', max_length=20, verbose_name='Channel Status')),
                ('stream_url', models.URLField(blank=True, help_text='URL for live streaming of the channel', verbose_name='Stream URL')),
                ('backup_stream_url', models.URLField(blank=True, help_text='URL for backup live streaming in case of issues', verbose_name='Backup Stream URL')),
                ('logo', models.ImageField(blank=True, help_text='Logo or image representing the channel', null=True, upload_to='channels/logos/', verbose_name='Channel Logo')),
                ('description', models.TextField(blank=True, help_text='Short description or tagline about the channel', verbose_name='Channel Description')),
                ('website', models.URLField(blank=True, help_text='Official website of the channel', verbose_name='Channel Website')),
                ('language', models.CharField(blank=True, help_text='Language of the content broadcasted on the channel', max_length=250, verbose_name='Channel Language')),
                ('category', models.CharField(blank=True, help_text='Category of content broadcasted on the channel (e.g., News, Sports, Entertainment)', max_length=250, verbose_name='Channel Category')),
                ('target_audience', models.CharField(blank=True, help_text='Specific demographic or group the channel is targeting (e.g., Teens, Mature, Children)', max_length=100, verbose_name='Target Audience')),
                ('supports_dai', models.BooleanField(default=True, help_text='Dynamic Ad Insertion support', verbose_name='Supports DAI')),
                ('max_ad_duration', models.PositiveIntegerField(default=180, help_text='Maximum ad break duration in seconds', verbose_name='Max Ad Duration')),
                ('min_ad_gap', models.PositiveIntegerField(default=300, help_text='Minimum gap between ads in seconds', verbose_name='Min Ad Gap')),
                ('last_health_check', models.DateTimeField(blank=True, null=True, verbose_name='Last Health Check')),
                ('is_online', models.BooleanField(default=True, verbose_name='Is Online')),
            ],
            options={
                'db_table': 'channels',
                'ordering': ['channel_number', 'name'],
            },
        ),
        migrations.CreateModel(
            name='Jingle',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Date and time when the record was created', verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Date and time when the record was last updated', verbose_name='Updated At')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Unique identifier for this record', primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False, help_text='Whether this record has been soft deleted', verbose_name='Is Deleted')),
                ('deleted_at', models.DateTimeField(blank=True, help_text='Date and time when the record was deleted', null=True, verbose_name='Deleted At')),
                ('name', models.CharField(max_length=255)),
                ('jingle_type', models.CharField(choices=[('station_id', 'Station ID'), ('bumper', 'Bumper'), ('promo', 'Promo'), ('transition', 'Transition'), ('commercial_break', 'Commercial Break')], max_length=20)),
                ('file', models.FileField(upload_to='jingles/')),
                ('duration', models.PositiveIntegerField(help_text='Duration in seconds')),
                ('is_active', models.BooleanField(default=True)),
                ('priority', models.PositiveIntegerField(default=1, help_text='Higher number = higher priority')),
                ('start_date', models.DateField(blank=True, null=True)),
                ('end_date', models.DateField(blank=True, null=True)),
                ('time_slots', models.JSONField(blank=True, default=list)),
                ('play_count', models.PositiveIntegerField(default=0)),
                ('last_played', models.DateTimeField(blank=True, null=True)),
                ('channel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='jingles', to='channels.channel')),
                ('created_by', models.ForeignKey(blank=True, help_text='User who created this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_records', to=settings.AUTH_USER_MODEL)),
                ('deleted_by', models.ForeignKey(blank=True, help_text='User who deleted this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_deleted_records', to=settings.AUTH_USER_MODEL)),
                ('updated_by', models.ForeignKey(blank=True, help_text='User who last updated this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_records', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'jingles',
                'ordering': ['channel', '-priority', 'name'],
            },
        ),
        migrations.CreateModel(
            name='ChannelZone',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Date and time when the record was created', verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Date and time when the record was last updated', verbose_name='Updated At')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Unique identifier for this record', primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False, help_text='Whether this record has been soft deleted', verbose_name='Is Deleted')),
                ('deleted_at', models.DateTimeField(blank=True, help_text='Date and time when the record was deleted', null=True, verbose_name='Deleted At')),
                ('name', models.CharField(max_length=255)),
                ('code', models.CharField(max_length=10, unique=True)),
                ('description', models.TextField(blank=True)),
                ('timezone', models.CharField(default='UTC', max_length=50)),
                ('is_active', models.BooleanField(default=True)),
                ('created_by', models.ForeignKey(blank=True, help_text='User who created this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_records', to=settings.AUTH_USER_MODEL)),
                ('deleted_by', models.ForeignKey(blank=True, help_text='User who deleted this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_deleted_records', to=settings.AUTH_USER_MODEL)),
                ('updated_by', models.ForeignKey(blank=True, help_text='User who last updated this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_records', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'channel_zones',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='ChannelSchedule',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Date and time when the record was created', verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Date and time when the record was last updated', verbose_name='Updated At')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Unique identifier for this record', primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False, help_text='Whether this record has been soft deleted', verbose_name='Is Deleted')),
                ('deleted_at', models.DateTimeField(blank=True, help_text='Date and time when the record was deleted', null=True, verbose_name='Deleted At')),
                ('title', models.CharField(max_length=255)),
                ('schedule_type', models.CharField(choices=[('regular', 'Regular Programming'), ('special', 'Special Event'), ('maintenance', 'Maintenance'), ('test', 'Test Broadcast')], default='regular', max_length=20)),
                ('start_time', models.DateTimeField()),
                ('end_time', models.DateTimeField()),
                ('description', models.TextField(blank=True)),
                ('content_url', models.URLField(blank=True)),
                ('backup_content_url', models.URLField(blank=True)),
                ('allow_ads', models.BooleanField(default=True)),
                ('ad_break_duration', models.PositiveIntegerField(default=120, help_text='Ad break duration in seconds')),
                ('is_active', models.BooleanField(default=True)),
                ('channel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='schedules', to='channels.channel')),
                ('created_by', models.ForeignKey(blank=True, help_text='User who created this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_records', to=settings.AUTH_USER_MODEL)),
                ('deleted_by', models.ForeignKey(blank=True, help_text='User who deleted this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_deleted_records', to=settings.AUTH_USER_MODEL)),
                ('updated_by', models.ForeignKey(blank=True, help_text='User who last updated this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_records', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'channel_schedules',
                'ordering': ['channel', 'start_time'],
            },
        ),
        migrations.CreateModel(
            name='ChannelCodec',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Date and time when the record was created', verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Date and time when the record was last updated', verbose_name='Updated At')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Unique identifier for this record', primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False, help_text='Whether this record has been soft deleted', verbose_name='Is Deleted')),
                ('deleted_at', models.DateTimeField(blank=True, help_text='Date and time when the record was deleted', null=True, verbose_name='Deleted At')),
                ('name', models.CharField(max_length=100)),
                ('video_codec', models.CharField(max_length=50)),
                ('audio_codec', models.CharField(max_length=50)),
                ('resolution', models.CharField(blank=True, max_length=20)),
                ('bitrate', models.PositiveIntegerField(help_text='Bitrate in kbps')),
                ('frame_rate', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True)),
                ('created_by', models.ForeignKey(blank=True, help_text='User who created this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_records', to=settings.AUTH_USER_MODEL)),
                ('deleted_by', models.ForeignKey(blank=True, help_text='User who deleted this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_deleted_records', to=settings.AUTH_USER_MODEL)),
                ('updated_by', models.ForeignKey(blank=True, help_text='User who last updated this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_records', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'channel_codecs',
                'ordering': ['name'],
            },
        ),
        migrations.AddField(
            model_name='channel',
            name='codec',
            field=models.ForeignKey(blank=True, help_text='Codec configuration for video and audio', null=True, on_delete=django.db.models.deletion.SET_NULL, to='channels.channelcodec', verbose_name='Video/Audio Codec'),
        ),
        migrations.AddField(
            model_name='channel',
            name='created_by',
            field=models.ForeignKey(blank=True, help_text='User who created this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_records', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='channel',
            name='deleted_by',
            field=models.ForeignKey(blank=True, help_text='User who deleted this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_deleted_records', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='channel',
            name='updated_by',
            field=models.ForeignKey(blank=True, help_text='User who last updated this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_records', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='channel',
            name='zone',
            field=models.ForeignKey(blank=True, help_text='Geographic zone where the channel is active', null=True, on_delete=django.db.models.deletion.SET_NULL, to='channels.channelzone', verbose_name='Channel Zone'),
        ),
        migrations.CreateModel(
            name='EPGProgram',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Date and time when the record was created', verbose_name='Created At')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Date and time when the record was last updated', verbose_name='Updated At')),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Unique identifier for this record', primary_key=True, serialize=False)),
                ('is_deleted', models.BooleanField(default=False, help_text='Whether this record has been soft deleted', verbose_name='Is Deleted')),
                ('deleted_at', models.DateTimeField(blank=True, help_text='Date and time when the record was deleted', null=True, verbose_name='Deleted At')),
                ('title', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True)),
                ('program_type', models.CharField(choices=[('movie', 'Movie'), ('series', 'TV Series'), ('news', 'News'), ('sports', 'Sports'), ('documentary', 'Documentary'), ('entertainment', 'Entertainment'), ('kids', 'Kids'), ('music', 'Music'), ('other', 'Other')], default='other', max_length=20)),
                ('start_time', models.DateTimeField()),
                ('end_time', models.DateTimeField()),
                ('duration', models.PositiveIntegerField(help_text='Duration in minutes')),
                ('season_number', models.PositiveIntegerField(blank=True, null=True)),
                ('episode_number', models.PositiveIntegerField(blank=True, null=True)),
                ('original_air_date', models.DateField(blank=True, null=True)),
                ('content_rating', models.CharField(blank=True, max_length=10)),
                ('language', models.CharField(blank=True, max_length=50)),
                ('subtitles_available', models.BooleanField(default=False)),
                ('has_ad_breaks', models.BooleanField(default=True)),
                ('ad_break_positions', models.JSONField(blank=True, default=list)),
                ('channel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='programs', to='channels.channel')),
                ('created_by', models.ForeignKey(blank=True, help_text='User who created this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_records', to=settings.AUTH_USER_MODEL)),
                ('deleted_by', models.ForeignKey(blank=True, help_text='User who deleted this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_deleted_records', to=settings.AUTH_USER_MODEL)),
                ('updated_by', models.ForeignKey(blank=True, help_text='User who last updated this record', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_updated_records', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'epg_programs',
                'ordering': ['channel', 'start_time'],
                'indexes': [models.Index(fields=['channel', 'start_time'], name='epg_program_channel_f93799_idx'), models.Index(fields=['start_time', 'end_time'], name='epg_program_start_t_b40dc1_idx')],
            },
        ),
        migrations.AlterUniqueTogether(
            name='channel',
            unique_together={('channel_number', 'zone')},
        ),
    ]
