<?php

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

class CreatePanelsTable extends Migration
{
    public function up()
    {
        Schema::create('panels', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->enum('category', ['solar', 'wall']);
            $table->decimal('price', 16, 2);
            $table->string('image')->nullable();
            $table->text('description')->nullable();
            $table->decimal('roi_percentage', 8, 2)->default(0);
            $table->enum('roi_interval', [
                'Monthly',
                'Weekly',
                'Daily',
                'Hourly',
                'Every 30 Minutes',
                'Every 10 Minutes',
            ])->default('Daily');
            $table->unsignedInteger('duration')->default(30)->comment('Duration in days');
            $table->boolean('return_capital')->default(false);
            $table->enum('status', ['active', 'inactive'])->default('active');
            $table->unsignedInteger('sort_order')->default(0);
            $table->timestamps();
            $table->softDeletes();
        });
    }

    public function down()
    {
        Schema::dropIfExists('panels');
    }
}
