# Generated by Django 5.0.14 on 2026-01-08 06:56

import django.db.models.deletion
import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='PhysicianMonthlyRating',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('year', models.IntegerField(db_index=True)),
                ('month', models.IntegerField(db_index=True, help_text='1-12')),
                ('average_rating', models.DecimalField(decimal_places=2, help_text='Average rating (1-5)', max_digits=3)),
                ('total_surveys', models.IntegerField(help_text='Number of surveys included')),
                ('positive_count', models.IntegerField(default=0)),
                ('neutral_count', models.IntegerField(default=0)),
                ('negative_count', models.IntegerField(default=0)),
                ('md_consult_rating', models.DecimalField(blank=True, decimal_places=2, max_digits=3, null=True)),
                ('hospital_rank', models.IntegerField(blank=True, help_text='Rank within hospital', null=True)),
                ('department_rank', models.IntegerField(blank=True, help_text='Rank within department', null=True)),
                ('metadata', models.JSONField(blank=True, default=dict)),
                ('staff', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='monthly_ratings', to='organizations.staff')),
            ],
            options={
                'ordering': ['-year', '-month', '-average_rating'],
                'indexes': [models.Index(fields=['staff', '-year', '-month'], name='physicians__staff_i_f4cc8b_idx'), models.Index(fields=['year', 'month', '-average_rating'], name='physicians__year_e38883_idx')],
                'unique_together': {('staff', 'year', 'month')},
            },
        ),
    ]
