<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration 
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('visits', function (Blueprint $table) {
            $table->id();
            $table->foreignId('patient_id')->constrained()->cascadeOnDelete();
            $table->foreignId('chamber_id')->constrained()->cascadeOnDelete();
            $table->dateTime('visit_date');
            $table->enum('status', ['Scheduled', 'Completed', 'Cancelled', 'No Show'])->default('Scheduled');
            $table->enum('type', ['New', 'Follow Up'])->default('New');
            $table->string('blood_pressure')->nullable();
            $table->decimal('weight', 5, 2)->nullable();
            $table->decimal('temperature', 5, 2)->nullable();
            $table->text('chief_complaints')->nullable();
            $table->text('clinical_findings')->nullable();
            $table->text('diagnosis')->nullable();
            $table->text('advice')->nullable();
            $table->decimal('fee_collected', 8, 2)->default(0);
            $table->text('internal_notes')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('visits');
    }
};
