<?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
    {
        $sql = <<<'SQL'
            CREATE TABLE sticker_details (
                id					               	BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
                sticker_structure_detail_id         BIGINT NOT NULL,
                design_element_type                 TEXT,
                element_id                          TEXT,
                element_type                        TEXT,
                string_value                        TEXT,
                string_font                         TEXT,
                string_size                         TEXT,
                element_colour                      TEXT,
                string_align                        TEXT,
                string_x_value                      TEXT,
                string_y_value                      TEXT,
                shape_name                          TEXT,
                shape_pen_size                      TEXT,
                shape_x1_value                      TEXT,
                shape_y1_value                      TEXT,
                shape_x2_value                      TEXT,
                shape_y2_value                      TEXT,
                image_path                          TEXT,
                image_type                          TEXT,
                image_x                             TEXT,
                image_y                             TEXT,
                image_width                         TEXT,
                image_height                        TEXT,
                qr_value                            TEXT,
                qr_align                            TEXT,
                qr_size                             TEXT,
                qr_x_value                          TEXT,
                qr_y_value                          TEXT,

                created_at							TIMESTAMP NOT NULL DEFAULT NOW(),
                updated_at							TIMESTAMP NOT NULL DEFAULT NOW(),
                created_by							TEXT DEFAULT NULL,
                updated_by							TEXT DEFAULT NULL,
                deleted_at			                TIMESTAMP,

                FOREIGN KEY (sticker_structure_detail_id)              REFERENCES  sticker_structure_details (id)
            );
        SQL;
        DB::statement($sql);
    }

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