# Generated by Django 6.0.7 on 2026-07-23 10:55

import django.db.models.deletion
import uuid
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('accounts', '0006_company_default_template'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Employee',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('full_name', models.CharField(max_length=255)),
                ('staff_number', models.CharField(blank=True, max_length=64)),
                ('position', models.CharField(blank=True, max_length=255)),
                ('email', models.EmailField(blank=True, max_length=254)),
                ('phone', models.CharField(blank=True, max_length=50)),
                ('kra_pin', models.CharField(blank=True, max_length=32)),
                ('nssf_number', models.CharField(blank=True, max_length=64)),
                ('shif_number', models.CharField(blank=True, max_length=64)),
                ('basic_salary', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('allowances', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('bank_name', models.CharField(blank=True, max_length=255)),
                ('bank_account', models.CharField(blank=True, max_length=64)),
                ('hire_date', models.DateField(blank=True, null=True)),
                ('is_active', models.BooleanField(default=True)),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='employees', to='accounts.company')),
            ],
            options={
                'ordering': ['full_name'],
            },
        ),
        migrations.CreateModel(
            name='PayrollRun',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('period_year', models.PositiveIntegerField()),
                ('period_month', models.PositiveSmallIntegerField()),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('finalised', 'Finalised')], default='draft', max_length=20)),
                ('employee_count', models.PositiveIntegerField(default=0)),
                ('total_gross', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('total_deductions', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('total_net', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payroll_runs', to='accounts.company')),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='payroll_runs', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-period_year', '-period_month'],
                'unique_together': {('company', 'period_year', 'period_month')},
            },
        ),
        migrations.CreateModel(
            name='Payslip',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('employee_name', models.CharField(max_length=255)),
                ('basic_salary', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('allowances', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('gross_pay', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('taxable_income', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('paye', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('nssf', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('shif', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('housing_levy', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('other_deductions', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('total_deductions', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('net_pay', models.DecimalField(decimal_places=2, default=0, max_digits=14)),
                ('employee', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='payslips', to='payroll.employee')),
                ('run', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payslips', to='payroll.payrollrun')),
            ],
            options={
                'ordering': ['employee_name'],
            },
        ),
    ]
