# Generated by Django 5.0.2 on 2025-07-24 17:15

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


class Migration(migrations.Migration):

    dependencies = [
        ('billing', '0001_initial'),
        ('customers', '0005_customer_account_balance_customerbalancetransaction'),
    ]

    operations = [
        migrations.CreateModel(
            name='ServicePeriod',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('service_start', models.DateTimeField(help_text='Exact start time of service period')),
                ('service_end', models.DateTimeField(help_text='Exact end time of service period')),
                ('status', models.CharField(choices=[('active', 'Active'), ('expired', 'Expired'), ('suspended', 'Suspended'), ('cancelled', 'Cancelled')], default='active', max_length=20)),
                ('is_auto_renewed', models.BooleanField(default=False, help_text='Was this period auto-renewed from account balance?')),
                ('renewal_attempted_at', models.DateTimeField(blank=True, null=True)),
                ('suspended_at', models.DateTimeField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='service_periods', to='customers.customer')),
                ('invoice', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='billing.invoice')),
                ('package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='customers.package')),
            ],
            options={
                'ordering': ['-service_start'],
            },
        ),
    ]
