<?php

namespace App\Domain\Clinical;

use App\Models\Tenant;

/**
 * Starter catalog seeded into every new clinic (editable afterwards).
 * Prices are typical Iraqi market values in whole IQD — owners adjust them.
 */
class DefaultProcedures
{
    public static function seed(Tenant $tenant): void
    {
        foreach (self::catalog() as $row) {
            $tenant->id; // tenant context is set by the caller; tenant_id explicit below
            \App\Models\Procedure::withoutEvents(fn () => \App\Models\Procedure::create(
                $row + ['tenant_id' => $tenant->id]
            ));
        }
    }

    public static function catalog(): array
    {
        return [
            ['name_en' => 'Consultation & examination', 'name_ar' => 'فحص واستشارة', 'category' => 'diagnostic', 'default_price' => 10000, 'default_duration_min' => 15, 'default_condition' => null],
            ['name_en' => 'Panoramic X-ray', 'name_ar' => 'أشعة بانوراما', 'category' => 'diagnostic', 'default_price' => 15000, 'default_duration_min' => 15, 'default_condition' => null],
            ['name_en' => 'Periapical X-ray', 'name_ar' => 'أشعة ذروية', 'category' => 'diagnostic', 'default_price' => 5000, 'default_duration_min' => 10, 'default_condition' => null],
            ['name_en' => 'Scaling & polishing', 'name_ar' => 'تنظيف وتلميع الأسنان', 'category' => 'preventive', 'default_price' => 25000, 'default_duration_min' => 30, 'default_condition' => null],
            ['name_en' => 'Fluoride application', 'name_ar' => 'تطبيق الفلورايد', 'category' => 'preventive', 'default_price' => 15000, 'default_duration_min' => 20, 'default_condition' => null],
            ['name_en' => 'Composite filling', 'name_ar' => 'حشوة تجميلية (كومبوزت)', 'category' => 'restorative', 'default_price' => 35000, 'default_duration_min' => 45, 'default_condition' => 'filling'],
            ['name_en' => 'Amalgam filling', 'name_ar' => 'حشوة أملغم', 'category' => 'restorative', 'default_price' => 25000, 'default_duration_min' => 40, 'default_condition' => 'filling'],
            ['name_en' => 'Glass ionomer filling', 'name_ar' => 'حشوة زجاجية', 'category' => 'restorative', 'default_price' => 25000, 'default_duration_min' => 35, 'default_condition' => 'filling'],
            ['name_en' => 'Root canal — anterior', 'name_ar' => 'حشوة عصب — أمامي', 'category' => 'endodontics', 'default_price' => 75000, 'default_duration_min' => 60, 'default_condition' => 'root_canal'],
            ['name_en' => 'Root canal — premolar', 'name_ar' => 'حشوة عصب — ضاحك', 'category' => 'endodontics', 'default_price' => 100000, 'default_duration_min' => 75, 'default_condition' => 'root_canal'],
            ['name_en' => 'Root canal — molar', 'name_ar' => 'حشوة عصب — طاحن', 'category' => 'endodontics', 'default_price' => 125000, 'default_duration_min' => 90, 'default_condition' => 'root_canal'],
            ['name_en' => 'Zirconia crown', 'name_ar' => 'تاج زيركون', 'category' => 'prosthodontics', 'default_price' => 150000, 'default_duration_min' => 60, 'default_condition' => 'crown'],
            ['name_en' => 'Porcelain-fused-to-metal crown', 'name_ar' => 'تاج خزف على معدن', 'category' => 'prosthodontics', 'default_price' => 100000, 'default_duration_min' => 60, 'default_condition' => 'crown'],
            ['name_en' => 'Dental bridge (per unit)', 'name_ar' => 'جسر أسنان (لكل وحدة)', 'category' => 'prosthodontics', 'default_price' => 125000, 'default_duration_min' => 60, 'default_condition' => 'bridge'],
            ['name_en' => 'Complete denture (per arch)', 'name_ar' => 'طقم كامل (للفك)', 'category' => 'prosthodontics', 'default_price' => 400000, 'default_duration_min' => 60, 'default_condition' => null],
            ['name_en' => 'Simple extraction', 'name_ar' => 'قلع بسيط', 'category' => 'surgery', 'default_price' => 25000, 'default_duration_min' => 30, 'default_condition' => 'extraction'],
            ['name_en' => 'Surgical extraction', 'name_ar' => 'قلع جراحي', 'category' => 'surgery', 'default_price' => 75000, 'default_duration_min' => 60, 'default_condition' => 'extraction'],
            ['name_en' => 'Wisdom tooth extraction', 'name_ar' => 'قلع ضرس العقل', 'category' => 'surgery', 'default_price' => 100000, 'default_duration_min' => 60, 'default_condition' => 'extraction'],
            ['name_en' => 'Dental implant (fixture)', 'name_ar' => 'زراعة سن (الغرسة)', 'category' => 'surgery', 'default_price' => 600000, 'default_duration_min' => 90, 'default_condition' => 'implant'],
            ['name_en' => 'Teeth whitening — in office', 'name_ar' => 'تبييض الأسنان — في العيادة', 'category' => 'cosmetic', 'default_price' => 150000, 'default_duration_min' => 60, 'default_condition' => null],
            ['name_en' => 'Veneer (per tooth)', 'name_ar' => 'فينير (لكل سن)', 'category' => 'cosmetic', 'default_price' => 175000, 'default_duration_min' => 60, 'default_condition' => 'veneer'],
            ['name_en' => 'Orthodontic consultation', 'name_ar' => 'استشارة تقويم', 'category' => 'orthodontics', 'default_price' => 15000, 'default_duration_min' => 30, 'default_condition' => null],
            ['name_en' => 'Fixed braces (per arch)', 'name_ar' => 'تقويم ثابت (للفك)', 'category' => 'orthodontics', 'default_price' => 750000, 'default_duration_min' => 90, 'default_condition' => null],
            ['name_en' => 'Braces adjustment visit', 'name_ar' => 'زيارة شد التقويم', 'category' => 'orthodontics', 'default_price' => 25000, 'default_duration_min' => 20, 'default_condition' => null],
        ];
    }
}
