<?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 DEFAULT NULL,
                element_id                          TEXT DEFAULT NULL,
                element_type                        TEXT DEFAULT NULL,
                string_value                        TEXT DEFAULT NULL,
                string_font                         TEXT DEFAULT NULL,
                string_size                         TEXT DEFAULT NULL,
                element_colour                      TEXT DEFAULT NULL,
                string_align                        TEXT DEFAULT NULL,
                string_x_value                      TEXT DEFAULT NULL,
                string_y_value                      TEXT DEFAULT NULL,
                shape_name                          TEXT DEFAULT NULL,
                shape_pen_size                      TEXT DEFAULT NULL,
                shape_x1_value                      TEXT DEFAULT NULL,
                shape_y1_value                      TEXT DEFAULT NULL,
                shape_x2_value                      TEXT DEFAULT NULL,
                shape_y2_value                      TEXT DEFAULT NULL,
                image_path                          TEXT DEFAULT NULL,
                image_type                          TEXT DEFAULT NULL,
                image_x                             TEXT DEFAULT NULL,
                image_y                             TEXT DEFAULT NULL,
                image_width                         TEXT DEFAULT NULL,
                image_height                        TEXT DEFAULT NULL,
                qr_value                            TEXT DEFAULT NULL,
                qr_align                            TEXT DEFAULT NULL,
                qr_size                             TEXT DEFAULT NULL,
                qr_x_value                          TEXT DEFAULT NULL,
                qr_y_value                          TEXT DEFAULT NULL,
                characteristics_type                TEXT DEFAULT NULL,
                curve_radius                        TEXT DEFAULT NULL,

                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');
    }
};
