<?php

use App\Models\Client;
use App\Models\Solution;
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('client_inputs', function (Blueprint $table) {
            $table->id();
            $table->foreignIdFor(App\Models\PostalCode::class);
            $table->integer('consommation_en_dh');
            $table->integer('consommation_en_kw');
            $table->string('toiture');
            $table->string('degree_inclination')->nullable();
            $table->boolean('double_orientation')->default(false);
            $table->string('orientation');
            $table->string('orientation_secondaire')->nullable();
            $table->string('type_courant');
            $table->text('remarque')->nullable();
            $table->foreignIdFor(Solution::class);
            $table->foreignIdFor(Client::class);

            $table->timestamps();

            $table->index('toiture');
            $table->index('degree_inclination');
            $table->index('orientation');
            $table->index('orientation_secondaire');
            $table->index('type_courant');
        });
    }

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