from django.db import migrations, models


INDUSTRIES = [
    'Agriculture and Agribusiness', 'Arts, Culture and Entertainment', 'Banking and Financial Services',
    'Construction and Real Estate', 'Consulting and Professional Services', 'Education and Research',
    'Energy, Oil and Gas', 'Engineering and Manufacturing', 'Government and Public Service',
    'Healthcare and Pharmaceuticals', 'Hospitality and Tourism', 'Information Technology',
    'Legal Services', 'Media and Communications', 'Nonprofit and Ministry', 'Retail and Consumer Goods',
    'Telecommunications', 'Transport and Logistics', 'Other',
]


def seed_industries(apps, schema_editor):
    Industry = apps.get_model('core', 'Industry')
    Industry.objects.bulk_create([Industry(name=name, display_order=index * 10) for index, name in enumerate(INDUSTRIES, 1)])


class Migration(migrations.Migration):
    dependencies = [('core', '0001_initial')]
    operations = [
        migrations.CreateModel(
            name='Industry',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=120, unique=True)),
                ('active', models.BooleanField(default=True)),
                ('display_order', models.PositiveSmallIntegerField(default=100)),
            ],
            options={'verbose_name_plural': 'Industries', 'ordering': ['display_order', 'name']},
        ),
        migrations.RunPython(seed_industries, migrations.RunPython.noop),
    ]
