# Generated by Django 5.0.4 on 2024-10-15 07:22

import api.utils.file_paths
import django.db.models.deletion
import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Metadata',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('label', models.CharField(max_length=75)),
                ('data_standard', models.CharField(blank=True, choices=[('DCATV3', 'Dcatv3'), ('OCDS', 'Ocds'), ('OBDS', 'Obds'), ('NA', 'Na')], max_length=50)),
                ('urn', models.CharField(blank=True, max_length=175, unique=True)),
                ('data_type', models.CharField(choices=[('STRING', 'String'), ('NUMBER', 'Number'), ('SELECT', 'Select'), ('MULTISELECT', 'Multiselect'), ('DATE', 'Date'), ('URL', 'Url')], max_length=50)),
                ('options', models.JSONField(blank=True, null=True)),
                ('validator', models.JSONField(blank=True, default=list)),
                ('validator_options', models.JSONField(blank=True, null=True)),
                ('type', models.CharField(choices=[('REQUIRED', 'Required'), ('OPTIONAL', 'Optional'), ('ADVANCED', 'Advanced')], max_length=50)),
                ('model', models.CharField(choices=[('DATASET', 'Dataset'), ('RESOURCE', 'Reseource')], max_length=50)),
                ('enabled', models.BooleanField(default=False)),
                ('filterable', models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name='ResourcePreviewDetails',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_all_entries', models.BooleanField(default=True)),
                ('start_entry', models.IntegerField(default=0)),
                ('end_entry', models.IntegerField(default=10)),
            ],
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.CharField(max_length=50, unique=True)),
            ],
            options={
                'verbose_name': 'Tag',
                'verbose_name_plural': 'Tags',
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=75, unique=True)),
                ('description', models.CharField(blank=True, max_length=1000, null=True)),
                ('slug', models.SlugField(max_length=75, null=True, unique=True)),
                ('parent_id', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='api.category')),
            ],
        ),
        migrations.CreateModel(
            name='Dataset',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('title', models.CharField(blank=True, max_length=300)),
                ('description', models.CharField(blank=True, max_length=1000)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('status', models.CharField(choices=[('DRAFT', 'Draft'), ('PUBLISHED', 'Published'), ('ARCHIVED', 'Archived')], default='DRAFT', max_length=50)),
                ('categories', models.ManyToManyField(blank=True, to='api.category')),
            ],
        ),
        migrations.CreateModel(
            name='Geography',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=75, unique=True)),
                ('code', models.CharField(blank=True, default='', max_length=100, null=True)),
                ('type', models.CharField(choices=[('DISTRICT', 'District'), ('STATE', 'State'), ('COUNTRY', 'Country'), ('UT', 'Ut')], max_length=20)),
                ('parent_id', models.ForeignKey(blank=True, default='', null=True, on_delete=django.db.models.deletion.CASCADE, to='api.geography')),
            ],
        ),
        migrations.CreateModel(
            name='DatasetMetadata',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.CharField(max_length=1000)),
                ('dataset', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='metadata', to='api.dataset')),
                ('metadata_item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.metadata')),
            ],
        ),
        migrations.CreateModel(
            name='Organization',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('description', models.CharField(max_length=1000)),
                ('logo', models.ImageField(blank=True, null=True, upload_to=api.utils.file_paths._organization_directory_path)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('homepage', models.URLField(blank=True)),
                ('contact_email', models.EmailField(blank=True, max_length=254, null=True)),
                ('organization_types', models.CharField(choices=[('STATE GOVERNMENT', 'State Government'), ('UNION TERRITORY GOVERNMENT', 'Union Territory Government'), ('URBAN LOCAL BODY', 'Urban Local Body'), ('ACADEMIC INSTITUTION', 'Academic Institution'), ('CENTRAL GOVERNMENT', 'Central Government'), ('CITIZENS GROUP', 'Citizens Group'), ('CIVIL SOCIETY ORGANISATION', 'Civil Society Organisation'), ('INDUSTRY BODY', 'Industry Body'), ('MEDIA ORGANISATION', 'Media Organisation'), ('OPEN DATA/TECHNOLOGY COMMUNITY', 'Open Data Technology Community'), ('PRIVATE COMPANY', 'Private Company'), ('PUBLIC SECTOR COMPANY', 'Public Sector Company'), ('OTHERS', 'Others'), ('STARTUP', 'Startup'), ('GOVERNMENT', 'Government'), ('CORPORATIONS', 'Corporations'), ('NGO', 'Ngo')], max_length=50)),
                ('slug', models.SlugField(max_length=75, null=True, unique=True)),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='parent_field', to='api.organization')),
            ],
        ),
        migrations.AddField(
            model_name='dataset',
            name='organization',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='api.organization'),
        ),
        migrations.CreateModel(
            name='AccessModel',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(blank=True, max_length=300, null=True)),
                ('description', models.CharField(blank=True, max_length=1000, null=True)),
                ('type', models.CharField(choices=[('PUBLIC', 'Public'), ('PRIVATE', 'Private'), ('PROTECTED', 'Protected')], default='PUBLIC', max_length=100)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('dataset', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.dataset')),
                ('organization', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='api.organization')),
            ],
        ),
        migrations.CreateModel(
            name='Resource',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('type', models.CharField(choices=[('API', 'Api'), ('FILE', 'File'), ('EXTERNAL', 'External')], default='FILE', max_length=50)),
                ('name', models.CharField(blank=True, max_length=50)),
                ('description', models.CharField(blank=True, max_length=1000)),
                ('preview_enabled', models.BooleanField(default=False)),
                ('dataset', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='resources', to='api.dataset')),
                ('preview_details', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='api.resourcepreviewdetails')),
            ],
        ),
        migrations.CreateModel(
            name='ResourceFileDetails',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('file', models.FileField(upload_to='resources/')),
                ('size', models.FloatField(blank=True, null=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('format', models.CharField(max_length=50)),
                ('resource', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='api.resource')),
            ],
        ),
        migrations.CreateModel(
            name='ResourceMetadata',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.CharField(max_length=1000)),
                ('metadata_item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.metadata')),
                ('resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.resource')),
            ],
        ),
        migrations.CreateModel(
            name='ResourceSchema',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('field_name', models.CharField(max_length=255)),
                ('format', models.CharField(choices=[('STRING', 'String'), ('NUMBER', 'Number'), ('INTEGER', 'Integer'), ('DATE', 'Date')], max_length=255)),
                ('description', models.CharField(blank=True, max_length=1000, null=True)),
                ('resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.resource')),
            ],
        ),
        migrations.CreateModel(
            name='ResourceChartDetails',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(blank=True, max_length=50)),
                ('description', models.CharField(blank=True, max_length=1000)),
                ('chart_type', models.CharField(choices=[('BAR_VERTICAL', 'Bar Vertical'), ('BAR_HORIZONTAL', 'Bar Horizontal'), ('LINE', 'Line'), ('ASSAM_DISTRICT', 'Assam District'), ('ASSAM_RC', 'Assam Rc')], default='BAR_HORIZONTAL', max_length=50)),
                ('x_axis_label', models.CharField(default='', max_length=50)),
                ('y_axis_label', models.CharField(default='', max_length=50)),
                ('show_legend', models.BooleanField(default=False)),
                ('aggregate_type', models.CharField(choices=[('NONE', 'None'), ('SUM', 'Sum'), ('AVERAGE', 'Average'), ('COUNT', 'Count')], default='NONE', max_length=50)),
                ('resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.resource')),
                ('region_column', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='region', to='api.resourceschema')),
                ('value_column', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='value', to='api.resourceschema')),
                ('x_axis_column', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='x_column', to='api.resourceschema')),
                ('y_axis_column', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='y_column', to='api.resourceschema')),
            ],
        ),
        migrations.CreateModel(
            name='AccessModelResource',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('access_model', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.accessmodel')),
                ('resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.resource')),
                ('fields', models.ManyToManyField(to='api.resourceschema')),
            ],
        ),
        migrations.AddField(
            model_name='dataset',
            name='tags',
            field=models.ManyToManyField(blank=True, to='api.tag'),
        ),
    ]
