<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('products', function (Blueprint $table) {
            $table->id();
            $table->string('title', 255);
            $table->string('title_en', 255)->nullable();
            $table->string('slug', 300)->unique();
            $table->foreignId('brand_id')->nullable()->constrained('brands')->nullOnDelete();
            $table->enum('type', ['simple', 'variable'])->default('simple');
            $table->longText('description')->nullable();
            $table->text('features')->nullable();
            $table->string('warranty', 255)->nullable();
            $table->string('tags', 1000)->nullable();
            $table->string('featured_image')->nullable();
            $table->string('featured_image_alt', 255)->nullable();
            $table->string('seo_title', 255)->nullable();
            $table->string('seo_description', 500)->nullable();
            $table->string('seo_keywords', 500)->nullable();
            $table->text('seo_schema')->nullable();
            $table->boolean('is_active')->default(true);
            $table->unsignedInteger('sort_order')->default(0);
            $table->timestamps();
        });
    }

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