<?php

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
    {
        //Pages
        Schema::create('homepage', function (Blueprint $table) {
            $table->id();
            $table->string('photo', 2048)->nullable();
            $table->string('photo_mobile', 2048)->nullable();
            $table->string('title', 2048)->nullable();
            $table->longText('body')->nullable();
            $table->longText('address')->nullable();
            $table->json('opening_hours')->nullable();
            $table->string('widget_link', 2048)->nullable();
            $table->timestamps();
        });

        //Pages
        Schema::create('link', function (Blueprint $table) {
            $table->id();
            $table->json('links')->nullable();
            $table->timestamps();
        });

        //Pages
        Schema::create('size', function (Blueprint $table) {
            $table->id();
            $table->string('small', 2048)->nullable();
            $table->string('small_photo', 2048)->nullable();
            $table->string('medium', 2048)->nullable();
            $table->string('medium_photo', 2048)->nullable();
            $table->string('large', 2048)->nullable();
            $table->string('large_photo', 2048)->nullable();
            $table->timestamps();
        });

        //Pages
        Schema::create('footer', function (Blueprint $table) {
            $table->id();
            $table->json('links')->nullable();
            $table->timestamps();
        });

        //Resources
        Schema::create('navigation_links', function (Blueprint $table) {
            $table->id();
            $table->integer('sort_order')->default(0);
            $table->string('name', 2048);
            $table->string('link', 2048);
            $table->boolean('external')->default(false);
            $table->timestamps();
        });

        //Resources
        Schema::create('products', function (Blueprint $table) {
            $table->id();
            $table->integer('sort_order')->default(0);
            $table->string('category', 2048);
            $table->string('description', 2048)->nullable();
            $table->json('products')->nullable();
            $table->timestamps();
        });

        //Resources
        Schema::create('photos', function (Blueprint $table) {
            $table->id();
            $table->integer('sort_order')->default(0);
            $table->string('name', 2048);
            $table->string('description', 2048)->nullable();
            $table->string('photo', 2048);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('homepage');
        Schema::dropIfExists('link');
        Schema::dropIfExists('size');
        Schema::dropIfExists('footer');
        Schema::dropIfExists('navigation_links');
        Schema::dropIfExists('products');
        Schema::dropIfExists('photos');
    }
};
