<?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
    {
        Schema::table('companies', function (Blueprint $table) {
            $table->string('qr_signing_secret', 64)->nullable()->after('support_email');
            $table->boolean('qr_card_enabled')->default(false)->after('qr_signing_secret');
            $table->boolean('qr_scanner_enabled')->default(false)->after('qr_card_enabled');
            $table->integer('qr_scanner_radius')->default(100)->after('qr_scanner_enabled');
            $table->boolean('activity_mandatory_enabled')->default(true)->after('qr_scanner_radius');
            $table->enum('activity_mandatory_scope', ['all', 'rules'])->default('all')->after('activity_mandatory_enabled');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('companies', function (Blueprint $table) {
            $table->dropColumn([
                'qr_signing_secret',
                'qr_card_enabled',
                'qr_scanner_enabled',
                'qr_scanner_radius',
                'activity_mandatory_enabled',
                'activity_mandatory_scope',
            ]);
        });
    }
};
