# Generated by Django 2.2.4 on 2019-08-09 10:40

from django.db import migrations, models
import django.db.models.deletion
import lino.core.choicelists
import lino.core.fields
import lino.modlib.system.choicelists
import lino.utils.addressable
import lino.utils.mldbc.fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('countries', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='CompanyType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', lino.utils.mldbc.fields.BabelCharField(max_length=200, verbose_name='Designation')),
                ('abbr', lino.utils.mldbc.fields.BabelCharField(blank=True, max_length=30, verbose_name='Abbreviation')),
                ('abbr_de', models.CharField(blank=True, max_length=30, verbose_name='Abbreviation (de)')),
                ('abbr_fr', models.CharField(blank=True, max_length=30, verbose_name='Abbreviation (fr)')),
                ('name_de', models.CharField(blank=True, max_length=200, verbose_name='Designation (de)')),
                ('name_fr', models.CharField(blank=True, max_length=200, verbose_name='Designation (fr)')),
            ],
            options={
                'verbose_name': 'Organization type',
                'verbose_name_plural': 'Organization types',
                'abstract': False,
            },
            bases=(models.Model, lino.core.fields.TableRow),
        ),
        migrations.CreateModel(
            name='Partner',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('email', models.EmailField(blank=True, help_text='The primary email address.', max_length=254, verbose_name='e-mail address')),
                ('language', lino.utils.mldbc.fields.LanguageField(blank=True, choices=[('en', 'English'), ('de', 'German'), ('fr', 'French')], help_text='The language to use when communicating with this partner.', max_length=5, verbose_name='Language')),
                ('url', models.URLField(blank=True, verbose_name='URL')),
                ('phone', models.CharField(blank=True, help_text='The primary phone number.', max_length=200, verbose_name='Phone')),
                ('gsm', models.CharField(blank=True, help_text='The primary mobile phone number.', max_length=200, verbose_name='GSM')),
                ('fax', models.CharField(blank=True, max_length=200, verbose_name='Fax')),
                ('zip_code', models.CharField(blank=True, max_length=10, verbose_name='Zip code')),
                ('addr1', models.CharField(blank=True, help_text='Address line before street', max_length=200, verbose_name='Address line before street')),
                ('street_prefix', models.CharField(blank=True, help_text='Text to print before name of street, but to ignore for sorting.', max_length=200, verbose_name='Street prefix')),
                ('street', models.CharField(blank=True, help_text='Name of street, without house number.', max_length=200, verbose_name='Street')),
                ('street_no', models.CharField(blank=True, help_text='House number.', max_length=10, verbose_name='No.')),
                ('street_box', models.CharField(blank=True, help_text='Text to print after street number on the same line.', max_length=10, verbose_name='Box')),
                ('addr2', models.CharField(blank=True, help_text='Address line to print below street line.', max_length=200, verbose_name='Address line after street')),
                ('prefix', models.CharField(blank=True, help_text='An optional name prefix. For organisations this is inserted\nbefore the name, for persons this is inserted between first\nname and last name.', max_length=200, verbose_name='Name prefix')),
                ('name', models.CharField(help_text='The full name of this partner. Used for alphabetic sorting.', max_length=200, verbose_name='Name')),
                ('remarks', models.TextField(blank=True, verbose_name='Remarks')),
                ('city', models.ForeignKey(blank=True, help_text='The locality, i.e. usually a village, city or town.', null=True, on_delete=django.db.models.deletion.PROTECT, to='countries.Place', verbose_name='Locality')),
                ('country', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='countries.Country')),
                ('region', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='contacts_partner_set_by_region', to='countries.Place', verbose_name='County')),
            ],
            options={
                'verbose_name': 'Partner',
                'verbose_name_plural': 'Partners',
                'abstract': False,
            },
            bases=(models.Model, lino.core.fields.TableRow, lino.utils.addressable.Addressable),
        ),
        migrations.CreateModel(
            name='RoleType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', lino.utils.mldbc.fields.BabelCharField(help_text='A translatable designation. Used e.g. in document templates\nfor contracts.', max_length=200, verbose_name='Designation')),
                ('name_de', models.CharField(blank=True, max_length=200, verbose_name='Designation (de)')),
                ('name_fr', models.CharField(blank=True, max_length=200, verbose_name='Designation (fr)')),
            ],
            options={
                'verbose_name': 'Function',
                'verbose_name_plural': 'Functions',
                'abstract': False,
            },
            bases=(models.Model, lino.core.fields.TableRow),
        ),
        migrations.CreateModel(
            name='Company',
            fields=[
                ('partner_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='contacts.Partner')),
                ('type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='contacts.CompanyType')),
            ],
            options={
                'verbose_name': 'Organization',
                'verbose_name_plural': 'Organizations',
                'abstract': False,
            },
            bases=('contacts.partner',),
        ),
        migrations.CreateModel(
            name='Person',
            fields=[
                ('partner_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='contacts.Partner')),
                ('title', models.CharField(blank=True, help_text='Used to specify a professional position or academic\nqualification like "Dr." or "PhD".', max_length=200, verbose_name='Title')),
                ('first_name', models.CharField(blank=True, help_text='The first name, also known as given name.', max_length=200, verbose_name='First name')),
                ('middle_name', models.CharField(blank=True, help_text='A space-separated list of all middle names.', max_length=200, verbose_name='Middle name')),
                ('last_name', models.CharField(blank=True, help_text='The last name, also known as family name.', max_length=200, verbose_name='Last name')),
                ('gender', lino.core.choicelists.ChoiceListField(blank=True, choicelist=lino.modlib.system.choicelists.Genders, choices=[(lino.core.choicelists.Choice('M', 'Male', 'male'), 'Male'), (lino.core.choicelists.Choice('F', 'Female', 'female'), 'Female')], help_text='The sex of this person (male or female).', max_length=10, verbose_name='Gender')),
                ('birth_date', lino.core.fields.IncompleteDateField(blank=True, help_text='Uncomplete dates are allowed, e.g. \n"00.00.1980" means "some day in 1980", \n"00.07.1980" means "in July 1980"\nor "23.07.0000" means "on a 23th of July".', verbose_name='Birth date')),
            ],
            options={
                'verbose_name': 'Person',
                'verbose_name_plural': 'Persons',
                'ordering': ['last_name', 'first_name'],
                'abstract': False,
            },
            bases=('contacts.partner', models.Model, lino.core.fields.TableRow),
        ),
        migrations.CreateModel(
            name='Role',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('type', models.ForeignKey(blank=True, help_text='The function of this person in this organization.', null=True, on_delete=django.db.models.deletion.PROTECT, to='contacts.RoleType')),
                ('company', models.ForeignKey(help_text='The organization where this person has this role.', on_delete=django.db.models.deletion.PROTECT, related_name='rolesbycompany', to='contacts.Company')),
                ('person', models.ForeignKey(help_text='The person having this role in this organization.', on_delete=django.db.models.deletion.PROTECT, related_name='rolesbyperson', to='contacts.Person')),
            ],
            options={
                'verbose_name': 'Contact Person',
                'verbose_name_plural': 'Contact Persons',
                'abstract': False,
            },
            bases=(models.Model, lino.core.fields.TableRow, lino.utils.addressable.Addressable),
        ),
    ]
