# Generated by Django 3.1.2 on 2021-01-23 19:10

import RIGS.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import versioning


class Migration(migrations.Migration):

    dependencies = [
        ('RIGS', '0038_auto_20200306_2000'),
    ]

    operations = [
        migrations.CreateModel(
            name='EventChecklist',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateField()),
                ('safe_parking', models.BooleanField(blank=True, help_text='Vehicles parked safely?<br><small>(does not obstruct venue access)</small>', null=True)),
                ('safe_packing', models.BooleanField(blank=True, help_text='Equipment packed away safely?<br><small>(including flightcases)</small>', null=True)),
                ('exits', models.BooleanField(blank=True, help_text='Emergency exits clear?', null=True)),
                ('trip_hazard', models.BooleanField(blank=True, help_text='Appropriate barriers around kit and cabling secured?', null=True)),
                ('warning_signs', models.BooleanField(blank=True, help_text='Warning signs in place?<br><small>(strobe, smoke, power etc.)</small>')),
                ('ear_plugs', models.BooleanField(blank=True, help_text='Ear plugs issued to crew where needed?', null=True)),
                ('hs_location', models.CharField(blank=True, help_text='Location of Safety Bag/Box', max_length=255, null=True)),
                ('extinguishers_location', models.CharField(blank=True, help_text='Location of fire extinguishers', max_length=255, null=True)),
                ('rcds', models.BooleanField(blank=True, help_text='RCDs installed where needed and tested?', null=True)),
                ('supply_test', models.BooleanField(blank=True, help_text='Electrical supplies tested?<br><small>(using socket tester)</small>', null=True)),
                ('earthing', models.BooleanField(blank=True, help_text='Equipment appropriately earthed?<br><small>(truss, stage, generators etc)</small>', null=True)),
                ('pat', models.BooleanField(blank=True, help_text='All equipment in PAT period?', null=True)),
                ('source_rcd', models.BooleanField(blank=True, help_text='Source RCD protected?<br><small>(if cable is more than 3m long) </small>', null=True)),
                ('labelling', models.BooleanField(blank=True, help_text='Appropriate and clear labelling on distribution and cabling?', null=True)),
                ('fd_voltage_l1', models.IntegerField(blank=True, help_text='L1 - N', null=True, verbose_name='First Distro Voltage L1-N')),
                ('fd_voltage_l2', models.IntegerField(blank=True, help_text='L2 - N', null=True, verbose_name='First Distro Voltage L2-N')),
                ('fd_voltage_l3', models.IntegerField(blank=True, help_text='L3 - N', null=True, verbose_name='First Distro Voltage L3-N')),
                ('fd_phase_rotation', models.BooleanField(blank=True, help_text='Phase Rotation<br><small>(if required)</small>', null=True, verbose_name='Phase Rotation')),
                ('fd_earth_fault', models.IntegerField(blank=True, help_text='Earth Fault Loop Impedance (Z<small>S</small>)', null=True, verbose_name='Earth Fault Loop Impedance')),
                ('fd_pssc', models.IntegerField(blank=True, help_text='Prospective Short Circuit Current', null=True, verbose_name='PSCC')),
                ('w1_description', models.CharField(blank=True, help_text='Description', max_length=255, null=True)),
                ('w1_polarity', models.BooleanField(blank=True, help_text='Polarity Checked?', null=True)),
                ('w1_voltage', models.IntegerField(blank=True, help_text='Voltage', null=True)),
                ('w1_earth_fault', models.IntegerField(blank=True, help_text='Earth Fault Loop Impedance (Z<small>S</small>)', null=True)),
                ('w2_description', models.CharField(blank=True, help_text='Description', max_length=255, null=True)),
                ('w2_polarity', models.BooleanField(blank=True, help_text='Polarity Checked?', null=True)),
                ('w2_voltage', models.IntegerField(blank=True, help_text='Voltage', null=True)),
                ('w2_earth_fault', models.IntegerField(blank=True, help_text='Earth Fault Loop Impedance (Z<small>S</small>)', null=True)),
                ('w3_description', models.CharField(blank=True, help_text='Description', max_length=255, null=True)),
                ('w3_polarity', models.BooleanField(blank=True, help_text='Polarity Checked?', null=True)),
                ('w3_voltage', models.IntegerField(blank=True, help_text='Voltage', null=True)),
                ('w3_earth_fault', models.IntegerField(blank=True, help_text='Earth Fault Loop Impedance (Z<small>S</small>)', null=True)),
                ('all_rcds_tested', models.BooleanField(blank=True, help_text='All circuit RCDs tested?<br><small>(using test button)</small>', null=True)),
                ('public_sockets_tested', models.BooleanField(blank=True, help_text='Public/Performer accessible circuits tested?<br><small>(using socket tester)</small>', null=True)),
                ('reviewed_at', models.DateTimeField(null=True)),
            ],
            options={
                'ordering': ['event'],
                'permissions': [('review_eventchecklist', 'Can review Event Checklists')],
            },
            bases=(models.Model, versioning.versioning.RevisionMixin),
        ),
        migrations.CreateModel(
            name='EventChecklistCrew',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('role', models.CharField(max_length=255)),
                ('start', models.DateTimeField()),
                ('end', models.DateTimeField()),
                ('checklist', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='crew', to='RIGS.eventchecklist')),
            ],
            bases=(models.Model, versioning.versioning.RevisionMixin),
        ),
        migrations.CreateModel(
            name='EventChecklistVehicle',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('vehicle', models.CharField(max_length=255)),
                ('checklist', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='vehicles', to='RIGS.eventchecklist')),
            ],
            bases=(models.Model, versioning.versioning.RevisionMixin),
        ),
        migrations.CreateModel(
            name='RiskAssessment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nonstandard_equipment', models.BooleanField(help_text="Does the event require any hired in equipment or use of equipment that is not covered by <a href='https://nottinghamtec.sharepoint.com/:f:/g/HealthAndSafety/Eo4xED_DrqFFsfYIjKzMZIIB6Gm_ZfR-a8l84RnzxtBjrA?e=Bf0Haw'>TEC's standard risk assessments and method statements?</a>")),
                ('nonstandard_use', models.BooleanField(help_text='Are TEC using their equipment in a way that is abnormal?<br><small>i.e. Not covered by TECs standard health and safety documentation</small>')),
                ('contractors', models.BooleanField(help_text='Are you using any external contractors?<br><small>i.e. Freelancers/Crewing Companies</small>')),
                ('other_companies', models.BooleanField(help_text='Are TEC working with any other companies on site?<br><small>e.g. TEC is providing the lighting while another company does sound</small>')),
                ('crew_fatigue', models.BooleanField(help_text='Is crew fatigue likely to be a risk at any point during this event?')),
                ('general_notes', models.TextField(blank=True, help_text='Did you have to consult a supervisor about any of the above? If so who did you consult and what was the outcome?', null=True)),
                ('big_power', models.BooleanField(help_text='Does the event require larger power supplies than 13A or 16A single phase wall sockets, or draw more than 20A total current?')),
                ('outside', models.BooleanField(help_text='Is the event outdoors?')),
                ('generators', models.BooleanField(help_text='Will generators be used?')),
                ('other_companies_power', models.BooleanField(help_text='Will TEC be supplying power to any other companies?')),
                ('nonstandard_equipment_power', models.BooleanField(help_text='Does the power plan require the use of any power equipment (distros, dimmers, motor controllers, etc.) that does not belong to TEC?')),
                ('multiple_electrical_environments', models.BooleanField(help_text='Will the electrical installation occupy more than one electrical environment?')),
                ('power_notes', models.TextField(blank=True, help_text='Did you have to consult a supervisor about any of the above? If so who did you consult and what was the outcome?', null=True)),
                ('power_plan', models.URLField(blank=True, help_text="Upload your power plan to the <a href='https://nottinghamtec.sharepoint.com/'>Sharepoint</a> and submit a link", null=True, validators=[RIGS.models.validate_url])),
                ('noise_monitoring', models.BooleanField(help_text='Does the event require noise monitoring or any non-standard procedures in order to comply with health and safety legislation or site rules?')),
                ('sound_notes', models.TextField(blank=True, help_text='Did you have to consult a supervisor about any of the above? If so who did you consult and what was the outcome?', null=True)),
                ('known_venue', models.BooleanField(help_text='Is this venue new to you (the MIC) or new to TEC?')),
                ('safe_loading', models.BooleanField(help_text='Are there any issues preventing a safe load in or out? (e.g. sufficient lighting, flat, not in a crowded area etc.)')),
                ('safe_storage', models.BooleanField(help_text='Are there any problems with safe and secure equipment storage?')),
                ('area_outside_of_control', models.BooleanField(help_text="Is any part of the work area out of TEC's direct control or openly accessible during the build or breakdown period?")),
                ('barrier_required', models.BooleanField(help_text='Is there a requirement for TEC to provide any barrier for security or protection of persons/equipment?')),
                ('nonstandard_emergency_procedure', models.BooleanField(help_text="Does the emergency procedure for the event differ from TEC's standard procedures?")),
                ('special_structures', models.BooleanField(help_text='Does the event require use of winch stands, motors, MPT Towers, or staging?')),
                ('suspended_structures', models.BooleanField(help_text="Are any structures (excluding projector screens and IWBs) being suspended from TEC's structures?")),
                ('persons_responsible_structures', models.TextField(blank=True, help_text='Who are the persons on site responsible for their use?', null=True)),
                ('rigging_plan', models.URLField(blank=True, help_text="Upload your rigging plan to the <a href='https://nottinghamtec.sharepoint.com/'>Sharepoint</a> and submit a link", null=True, validators=[RIGS.models.validate_url])),
                ('reviewed_at', models.DateTimeField(null=True)),
                ('supervisor_consulted', models.BooleanField(null=True)),
            ],
            options={
                'ordering': ['event'],
                'permissions': [('review_riskassessment', 'Can review Risk Assessments')],
            },
            bases=(models.Model, versioning.versioning.RevisionMixin),
        ),
        migrations.RemoveField(
            model_name='eventcrew',
            name='event',
        ),
        migrations.RemoveField(
            model_name='eventcrew',
            name='user',
        ),
        migrations.DeleteModel(
            name='RIGSVersion',
        ),
        migrations.RemoveField(
            model_name='event',
            name='risk_assessment_edit_url',
        ),
        migrations.AlterField(
            model_name='profile',
            name='first_name',
            field=models.CharField(blank=True, max_length=150, verbose_name='first name'),
        ),
        migrations.DeleteModel(
            name='EventCrew',
        ),
        migrations.AddField(
            model_name='riskassessment',
            name='event',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='RIGS.event'),
        ),
        migrations.AddField(
            model_name='riskassessment',
            name='power_mic',
            field=models.ForeignKey(blank=True, help_text='Who is the Power MIC? (if yes to the above question, this person <em>must</em> be a Power Technician or Power Supervisor)', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='power_mic', to=settings.AUTH_USER_MODEL, verbose_name='Power MIC'),
        ),
        migrations.AddField(
            model_name='riskassessment',
            name='reviewed_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Reviewer'),
        ),
        migrations.AddField(
            model_name='eventchecklistvehicle',
            name='driver',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='vehicles', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='eventchecklistcrew',
            name='crewmember',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='crewed', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='eventchecklist',
            name='event',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='checklists', to='RIGS.event'),
        ),
        migrations.AddField(
            model_name='eventchecklist',
            name='power_mic',
            field=models.ForeignKey(blank=True, help_text='Who is the Power MIC?', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='checklists', to=settings.AUTH_USER_MODEL, verbose_name='Power MIC'),
        ),
        migrations.AddField(
            model_name='eventchecklist',
            name='reviewed_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Reviewer'),
        ),
        migrations.AddField(
            model_name='eventchecklist',
            name='venue',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='RIGS.venue'),
        ),
    ]
