# Generated by Django 5.2 on 2026-04-04 00:00

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


class Migration(migrations.Migration):

    dependencies = [
        ('fields', '0006_e1c_chusankan_17_fields'),
        ('plans', '0004_crop_base_temp'),
    ]

    operations = [
        migrations.AddField(
            model_name='crop',
            name='seed_inventory_kg',
            field=models.DecimalField(decimal_places=3, default=0, max_digits=10, verbose_name='種もみ在庫(kg)'),
        ),
        migrations.AddField(
            model_name='variety',
            name='default_seedling_boxes_per_tan',
            field=models.DecimalField(decimal_places=2, default=0, max_digits=6, verbose_name='反当苗箱枚数デフォルト'),
        ),
        migrations.CreateModel(
            name='RiceTransplantPlan',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, verbose_name='計画名')),
                ('year', models.IntegerField(verbose_name='年度')),
                ('default_seed_grams_per_box', models.DecimalField(decimal_places=2, default=0, max_digits=8, verbose_name='苗箱1枚あたり種もみ(g)デフォルト')),
                ('notes', models.TextField(blank=True, default='', verbose_name='備考')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('variety', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='rice_transplant_plans', to='plans.variety', verbose_name='品種')),
            ],
            options={
                'verbose_name': '田植え計画',
                'verbose_name_plural': '田植え計画',
                'ordering': ['-year', 'variety'],
            },
        ),
        migrations.CreateModel(
            name='RiceTransplantEntry',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('seedling_boxes_per_tan', models.DecimalField(decimal_places=2, max_digits=6, verbose_name='反当苗箱枚数')),
                ('seed_grams_per_box', models.DecimalField(decimal_places=2, max_digits=8, verbose_name='苗箱1枚あたり種もみ(g)')),
                ('field', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rice_transplant_entries', to='fields.field', verbose_name='圃場')),
                ('plan', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='entries', to='plans.ricetransplantplan', verbose_name='田植え計画')),
            ],
            options={
                'verbose_name': '田植え計画エントリ',
                'verbose_name_plural': '田植え計画エントリ',
                'ordering': ['field__display_order', 'field__id'],
                'unique_together': {('plan', 'field')},
            },
        ),
    ]
