<?php

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

class AddProviderMetadataToOfferwallsTable extends Migration
{
    public function up()
    {
        Schema::table('offerwalls', function (Blueprint $table) {
            $table->string('type')->default('offer')->after('photo_path');
            $table->string('launch_mode')->default('iframe')->after('type');
            $table->string('background_color')->default('#202637')->after('launch_mode');
            $table->string('badge')->nullable()->after('background_color');
            $table->string('badge_color')->default('#22c55e')->after('badge');
            $table->boolean('show_rate')->default(true)->after('badge_color');
            $table->string('rate')->nullable()->after('show_rate');
            $table->unsignedInteger('unlock_level')->default(1)->after('rate');
            $table->boolean('is_mobile')->default(false)->after('unlock_level');
            $table->json('sdk_data')->nullable()->after('is_mobile');
            $table->text('description')->nullable()->after('sdk_data');
        });
    }

    public function down()
    {
        Schema::table('offerwalls', function (Blueprint $table) {
            $table->dropColumn([
                'type',
                'launch_mode',
                'background_color',
                'badge',
                'badge_color',
                'show_rate',
                'rate',
                'unlock_level',
                'is_mobile',
                'sdk_data',
                'description',
            ]);
        });
    }
}
