# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2021-04-22 11:25
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import orchestra.core.validators


class Migration(migrations.Migration):

    replaces = [('websites', '0001_initial'), ('websites', '0002_auto_20160219_1036'), ('websites', '0003_auto_20170528_2011'), ('websites', '0004_auto_20170625_1813'), ('websites', '0005_auto_20170625_1840'), ('websites', '0006_auto_20170625_1840'), ('websites', '0007_auto_20170625_1840'), ('websites', '0008_auto_20170625_1841'), ('websites', '0009_auto_20170625_2206'), ('websites', '0010_auto_20170625_2214'), ('websites', '0011_auto_20170704_1117'), ('websites', '0012_auto_20190805_1134'), ('websites', '0013_auto_20200204_1217'), ('websites', '0014_auto_20200204_1218'), ('websites', '0015_auto_20200204_1219'), ('websites', '0016_auto_20200204_1221'), ('websites', '0017_auto_20210330_1049')]

    initial = True

    dependencies = [
        ('domains', '0001_initial'),
        ('webapps', '0001_initial'),
        ('orchestration', '0007_auto_20170528_2011'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Content',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('path', models.CharField(blank=True, max_length=256, validators=[orchestra.core.validators.validate_url_path], verbose_name='path')),
                ('webapp', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='webapps.WebApp', verbose_name='web application')),
            ],
        ),
        migrations.CreateModel(
            name='Website',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128, validators=[orchestra.core.validators.validate_name], verbose_name='name')),
                ('protocol', models.CharField(choices=[('http', 'HTTP'), ('https', 'HTTPS'), ('http/https', 'HTTP and HTTPS'), ('https-only', 'HTTPS only')], default='http', help_text='Select the protocol(s) for this website<br><tt>HTTPS only</tt> performs a redirection from <tt>http</tt> to <tt>https</tt>.', max_length=16, verbose_name='protocol')),
                ('is_active', models.BooleanField(default=True, verbose_name='active')),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='websites', to=settings.AUTH_USER_MODEL, verbose_name='Account')),
                ('contents', models.ManyToManyField(through='websites.Content', to='webapps.WebApp')),
                ('domains', models.ManyToManyField(related_name='websites', to='domains.Domain', verbose_name='domains')),
            ],
        ),
        migrations.CreateModel(
            name='WebsiteDirective',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(choices=[(None, '-------'), ('HTTPD', [('redirect', 'Redirection'), ('proxy', 'Proxy'), ('error-document', 'ErrorDocumentRoot')]), ('SSL', [('ssl-ca', 'SSL CA'), ('ssl-cert', 'SSL cert'), ('ssl-key', 'SSL key')]), ('ModSecurity', [('sec-rule-remove', 'SecRuleRemoveById'), ('sec-engine', 'SecRuleEngine Off')]), ('SaaS', [('wordpress-saas', 'WordPress SaaS'), ('dokuwiki-saas', 'DokuWiki SaaS'), ('drupal-saas', 'Drupdal SaaS'), ('moodle-saas', 'Moodle SaaS')])], db_index=True, max_length=128, verbose_name='name')),
                ('value', models.CharField(blank=True, max_length=256, verbose_name='value')),
                ('website', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='directives', to='websites.Website', verbose_name='web site')),
            ],
        ),
        migrations.AddField(
            model_name='content',
            name='website',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='websites.Website', verbose_name='web site'),
        ),
        migrations.AlterField(
            model_name='website',
            name='domains',
            field=models.ManyToManyField(blank=True, related_name='websites', to='domains.Domain', verbose_name='domains'),
        ),
        migrations.AddField(
            model_name='website',
            name='target_server',
            field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='websites', to='orchestration.Server', verbose_name='Target Server'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='website',
            name='comments',
            field=models.TextField(blank=True, default=''),
        ),
        migrations.AlterUniqueTogether(
            name='website',
            unique_together=set([('name', 'account')]),
        ),
        migrations.AlterUniqueTogether(
            name='content',
            unique_together=set([('website', 'path')]),
        ),
    ]
