# Generated by Django 6.0.4 on 2026-07-18 04:22

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


class Migration(migrations.Migration):

    dependencies = [
        ('asset_management', '0005_vendor_governance'),
        ('publications', '0002_externalpublication_image'),
    ]

    operations = [
        migrations.AddField(
            model_name='stockmovement',
            name='unit_cost',
            field=models.DecimalField(blank=True, decimal_places=2, help_text="Cost per unit for 'in' movements. Recomputes StockItem.unit_cost as a weighted average.", max_digits=12, null=True),
        ),
        migrations.CreateModel(
            name='SellableItem',
            fields=[
                ('id', models.UUIDField(default=apps.asset_management.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('category', models.CharField(choices=[('book', 'Book'), ('accessory', 'Accessory')], max_length=20)),
                ('sale_price', models.DecimalField(decimal_places=2, max_digits=14)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('publication', models.ForeignKey(blank=True, help_text='Set only when category=book.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sellable_items', to='publications.publication')),
                ('stock_item', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='sellable', to='asset_management.stockitem')),
            ],
            options={
                'db_table': 'sellable_items',
                'ordering': ['-created_at'],
            },
        ),
    ]
