<?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('solar_projects', function (Blueprint $table) {
            $table->id(); $table->string('project_number')->unique(); $table->foreignId('customer_id')->nullable()->constrained()->nullOnDelete(); $table->string('site_address')->nullable(); $table->string('technician')->nullable(); $table->decimal('contract_amount',14,2)->default(0); $table->decimal('estimated_cost',14,2)->default(0); $table->date('start_date')->nullable(); $table->date('completion_date')->nullable(); $table->enum('status',['planning','active','completed','cancelled'])->default('planning'); $table->text('notes')->nullable(); $table->timestamps();
        });
    }

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