# Generated by Django 5.2.8 on 2025-11-20 23:27

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='CreditTransaction',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('transaction_type', models.CharField(choices=[('purchase', 'Purchase'), ('subscription', 'Subscription Renewal'), ('refund', 'Refund'), ('deduction', 'Usage Deduction'), ('adjustment', 'Manual Adjustment')], db_index=True, max_length=20)),
                ('amount', models.IntegerField(help_text='Positive for additions, negative for deductions')),
                ('balance_after', models.IntegerField(help_text='Credit balance after this transaction')),
                ('description', models.CharField(max_length=255)),
                ('metadata', models.JSONField(default=dict, help_text='Additional context (AI call details, etc.)')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'igny8_credit_transactions',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='CreditUsageLog',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('operation_type', models.CharField(choices=[('clustering', 'Keyword Clustering'), ('idea_generation', 'Content Ideas Generation'), ('content_generation', 'Content Generation'), ('image_generation', 'Image Generation'), ('reparse', 'Content Reparse'), ('ideas', 'Content Ideas Generation'), ('content', 'Content Generation'), ('images', 'Image Generation')], db_index=True, max_length=50)),
                ('credits_used', models.IntegerField(validators=[django.core.validators.MinValueValidator(0)])),
                ('cost_usd', models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True)),
                ('model_used', models.CharField(blank=True, max_length=100)),
                ('tokens_input', models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0)])),
                ('tokens_output', models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0)])),
                ('related_object_type', models.CharField(blank=True, max_length=50)),
                ('related_object_id', models.IntegerField(blank=True, null=True)),
                ('metadata', models.JSONField(default=dict)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'igny8_credit_usage_logs',
                'ordering': ['-created_at'],
            },
        ),
    ]
