<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('games', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('alt_titles')->nullable()->default(null);
            $table->integer('platform_id')->index()->unsigned();
            $table->text('description')->nullable()->default(null);
            $table->string('source')->nullable()->default(null);
            $table->string('boxart')->nullable()->default(null);
            $table->string('genre_ids')->nullable()->default(null);
            $table->string('developers')->nullable()->default(null);
            $table->string('publishers')->nullable()->default(null);
            $table->string('composers')->nullable()->default(null);
            $table->string('website')->nullable()->default(null);
            $table->timestamp('na_release_date')->nullable()->default(null);
            $table->timestamp('jp_release_date')->nullable()->default(null);
            $table->timestamp('eu_release_date')->nullable()->default(null);
            $table->timestamp('aus_release_date')->nullable()->default(null);
            $table->enum('esrb_rating', ['Everyone', 'Everyone 10+', 'Teen', 'Mature 17+', 'Adults Only 18+', 'Rating Pending', 'Rating Pending - Likely Mature 17+'])->nullable()->default(null); // phpcs:ignore
            $table->enum('pegi_rating', ['PEGI 3', 'PEGI 7', 'PEGI 12', 'PEGI 16', 'PEGI 18'])->nullable()->default(null); // phpcs:ignore
            $table->enum('cero_rating', ['CERO A', 'CERO B', 'CERO C', 'CERO D', 'CERO Z'])->nullable()->default(null); // phpcs:ignore
            $table->enum('acb_rating', ['E', 'G', 'PG', 'M', 'MA 15+', 'R 18+', 'X 18+'])->nullable()->default(null);
            $table->integer('requested_by')->index()->unsigned();
            $table->integer('added_by')->index()->unsigned();
            $table->timestamps();
            $table->softDeletes();
        });
    }

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