<?php

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

/**
 * PRC-1143 — konsolide şema: `downloads` tablosunun TAM tanımı (tek dosya).
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::create('downloads', function (Blueprint $t) {
            $t->id();
            $t->string('title', 255);
            $t->text('description')->nullable();
            $t->string('file_path', 255);
            $t->string('file_name', 255);
            $t->string('file_type', 255)->nullable();
            $t->bigInteger('file_size')->default(0);
            $t->string('category', 255)->default('general');
            $t->enum('status', ['active','inactive'])->default('active');
            $t->enum('visibility', ['public','clients_only'])->default('clients_only');
            $t->integer('download_count')->default(0);
            $t->integer('sort_order')->default(0);
            $t->string('version', 255)->nullable();
            $t->string('file_hash', 255)->nullable();
            $t->text('changelog')->nullable();
            $t->timestamp('created_at')->nullable();
            $t->timestamp('updated_at')->nullable();
        });
    }

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