text: # Generated by Django 3.2.9 on 2021-11-15 14:41
  
  import django.core.validators
  from django.db import migrations, models
  import django.db.models.deletion
  import rentcars.utils.paths
  import rentcars.validators
  
  
  class Migration(migrations.Migration):
  
      initial = True
  
      dependencies = [
          ('tgbot', '0002_delete_location'),
      ]
  
      operations = [
          migrations.CreateModel(
              name='Car',
              fields=[
                  ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('license_plate', models.CharField(max_length=9, validators=[rentcars.validators.license_plate_validator], verbose_name='Регистрационный знак')),
                  ('vin', models.CharField(max_length=17, validators=[rentcars.validators.vin_validator], verbose_name='VIN')),
                  ('model', models.CharField(max_length=50, verbose_name='Марка, модель')),
                  ('type', models.CharField(max_length=50, verbose_name='Тип ТС')),
                  ('category', models.CharField(help_text='Одна английская буква из ABCD', max_length=1, validators=[rentcars.validators.vehicle_category_validator], verbose_name='Категория ТС')),
                  ('year_manufacture', models.CharField(max_length=4, validators=[rentcars.validators.vehicle_manufactured_year_validator], verbose_name='Год выпуска')),
                  ('color', models.CharField(max_length=50, verbose_name='Цвет ТС')),
                  ('power', models.IntegerField(verbose_name='Мощность двигателя, л.с.')),
                  ('ecological_class', models.CharField(max_length=20, verbose_name='Экологический класс')),
                  ('vehicle_passport_serial', models.CharField(max_length=4, validators=[rentcars.validators.vehicle_passport_serial_validator], verbose_name='Серия ПТС')),
                  ('vehicle_passport_number', models.CharField(max_length=6, validators=[rentcars.validators.passport_number_validator], verbose_name='Номер ПТС')),
                  ('max_mass', models.IntegerField(verbose_name='Разрешенная max масса, кг')),
                  ('sts_serial', models.CharField(help_text='Серия свидетельства о регистрации ТС', max_length=4, validators=[rentcars.validators.sts_serial_validator], verbose_name='Серия СТС')),
                  ('sts_number', models.CharField(help_text='Номер свидетельства о регистрации ТС', max_length=6, validators=[rentcars.validators.sts_number_validator], verbose_name='Номер СТС')),
              ],
              options={
                  'verbose_name': 'Автомобиль',
                  'verbose_name_plural': 'Автомобили',
                  'ordering': ['license_plate'],
              },
          ),
          migrations.CreateModel(
              name='Contract',
              fields=[
                  ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('file', models.FileField(upload_to='contracts/files/', verbose_name='Файл договора')),
                  ('is_approved', models.BooleanField(default=False, verbose_name='Подтвержден')),
                  ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Дата формирования договора')),
                  ('approved_at', models.DateTimeField(blank=True, null=True, verbose_name='Дата подтверждения договора')),
                  ('closed_at', models.DateTimeField(null=True, verbose_name='Дата завершения действия договора')),
                  ('car', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='contracts', to='rentcars.car', verbose_name='Машина')),
                  ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='contracts', to='tgbot.user')),
              ],
              options={
                  'verbose_name': 'Договор',
                  'verbose_name_plural': 'Договоры',
              },
          ),
          migrations.CreateModel(
              name='PhotoCarContract',
              fields=[
                  ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('image', models.ImageField(upload_to=rentcars.utils.paths.contract_photos_path, verbose_name='Фотографии машины')),
                  ('file_id', models.CharField(blank=True, max_length=250, verbose_name='ID фотографии на серверах Telegram')),
                  ('contract', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='car_photos', to='rentcars.contract')),
              ],
              options={
                  'verbose_name': 'Фотография машины во время заключения договора',
                  'verbose_name_plural': 'Фотографии машины во время заключения договора',
              },
          ),
          migrations.CreateModel(
              name='PhotoCar',
              fields=[
                  ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('image', models.ImageField(upload_to=rentcars.utils.paths.car_photos_path, verbose_name='Фотографии машины')),
                  ('file_id', models.CharField(blank=True, max_length=250, verbose_name='ID фотографии на серверах Telegram')),
                  ('car', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='rentcars.car')),
              ],
              options={
                  'verbose_name': 'Фотография машины',
                  'verbose_name_plural': 'Фотографии машины',
              },
          ),
          migrations.CreateModel(
              name='PersonalData',
              fields=[
                  ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
                  ('updated_at', models.DateTimeField(auto_now=True)),
                  ('first_name', models.CharField(max_length=100, validators=[rentcars.validators.ru_eng_letters_validator], verbose_name='Имя')),
                  ('middle_name', models.CharField(max_length=100, validators=[rentcars.validators.ru_eng_letters_validator], verbose_name='Отчество')),
                  ('last_name', models.CharField(max_length=100, validators=[rentcars.validators.ru_eng_letters_validator], verbose_name='Фамилия')),
                  ('gender', models.IntegerField(choices=[(0, 'Муж'), (1, 'Жен')], verbose_name='Пол')),
                  ('birthday', models.DateField(validators=[rentcars.validators.birthday_date_validate], verbose_name='Дата рождения')),
                  ('email', models.EmailField(max_length=70, validators=[django.core.validators.EmailValidator(message='Адрес электронной почты должен быть правильным. Например, rustamwho@mail.com')], verbose_name='Почта')),
                  ('phone_number', models.CharField(max_length=12, validators=[rentcars.validators.phone_number_validator])),
                  ('passport_serial', models.CharField(max_length=4, validators=[rentcars.validators.passport_serial_validator], verbose_name='Серия паспорта')),
                  ('passport_number', models.CharField(max_length=6, validators=[rentcars.validators.passport_number_validator], verbose_name='Номер паспорта')),
                  ('passport_date_of_issue', models.DateField(verbose_name='Дата выдачи паспорта')),
                  ('passport_issued_by', models.CharField(max_length=255, validators=[rentcars.validators.passport_issued_by_validator], verbose_name='Кем выдан паспорт')),
                  ('address_registration', models.CharField(max_length=256, validators=[rentcars.validators.address_validator], verbose_name='Адрес прописки')),
                  ('address_of_residence', models.CharField(max_length=256, validators=[rentcars.validators.address_validator], verbose_name='Адрес места жительства')),
                  ('close_person_name', models.CharField(blank=True, max_length=50, null=True, validators=[rentcars.validators.close_person_name_validator], verbose_name='Близкий человек')),
                  ('close_person_phone', models.CharField(blank=True, max_length=12, null=True, validators=[rentcars.validators.phone_number_validator], verbose_name='Номер близкого человека')),
                  ('close_person_address', models.CharField(blank=True, max_length=256, null=True, validators=[rentcars.validators.address_validator], verbose_name='Адрес места жительства')),
                  ('user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='personal_data', to='tgbot.user')),
              ],
              options={
                  'verbose_name': 'Персональные данные',
                  'verbose_name_plural': 'Персональные данные',
              },
          ),
          migrations.CreateModel(
              name='Fine',
              fields=[
                  ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('datetime', models.DateTimeField(null=True, verbose_name='Дата и время штрафа')),
                  ('amount', models.PositiveIntegerField(verbose_name='Сумма штрафа')),
                  ('screenshot', models.ImageField(blank=True, null=True, upload_to=rentcars.utils.paths.fine_screens_path, verbose_name='Скриншот штрафа')),
                  ('screenshot_id', models.CharField(blank=True, max_length=250, null=True, verbose_name='ID скриншота на серверах Telegram')),
                  ('is_paid', models.BooleanField(default=False, verbose_name='Штраф оплачен')),
                  ('car', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fines', to='rentcars.car', verbose_name='Машина')),
                  ('contract', models.ForeignKey(blank=True, help_text='Заполнится автоматически после сохранения!', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='fines', to='rentcars.contract', verbose_name='Договор')),
                  ('user', models.ForeignKey(blank=True, help_text='Заполнится автоматически после сохранения!', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='fines', to='tgbot.user', verbose_name='Водитель')),
              ],
              options={
                  'verbose_name': 'Штраф',
                  'verbose_name_plural': 'Штрафы',
                  'ordering': ['is_paid', '-datetime'],
              },
          ),
          migrations.AddField(
              model_name='car',
              name='owner',
              field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='cars', to='rentcars.personaldata'),
          ),
      ]
  