<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('app_settings', function (Blueprint $table) {
            $table->string('app_name')->default('MyOpticals')->after('id');
            $table->string('app_logo')->nullable()->after('app_name');
            $table->string('currency_symbol')->default('₹')->after('app_logo');
            $table->string('currency_code')->default('INR')->after('currency_symbol');
            $table->boolean('enable_ar_tryon')->default(true)->after('force_update');
            $table->boolean('enable_iris_colorizer')->default(true)->after('enable_ar_tryon');
            $table->text('fcm_server_key')->nullable()->after('razorpay_key_secret');
            $table->string('mail_mailer')->default('smtp')->after('fcm_server_key');
            $table->string('mail_host')->nullable()->after('mail_mailer');
            $table->string('mail_port')->default('587')->after('mail_host');
            $table->string('mail_username')->nullable()->after('mail_port');
            $table->string('mail_password')->nullable()->after('mail_username');
            $table->string('mail_encryption')->default('tls')->after('mail_password');
            $table->string('mail_from_address')->nullable()->after('mail_encryption');
            $table->string('mail_from_name')->nullable()->after('mail_from_address');
        });
    }

    public function down(): void
    {
        Schema::table('app_settings', function (Blueprint $table) {
            $table->dropColumn([
                'app_name',
                'app_logo',
                'currency_symbol',
                'currency_code',
                'enable_ar_tryon',
                'enable_iris_colorizer',
                'fcm_server_key',
                'mail_mailer',
                'mail_host',
                'mail_port',
                'mail_username',
                'mail_password',
                'mail_encryption',
                'mail_from_address',
                'mail_from_name',
            ]);
        });
    }
};
