<?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('users', function (Blueprint $table) {
            $table->string('google_id')->nullable()->unique();
            $table->timestamp('phone_verified_at')->nullable();
            $table->string('phone_verification_code')->nullable();
            $table->timestamp('phone_verification_expires_at')->nullable();
            $table->smallInteger('phone_verification_attempts')->default(0);

            // Password nullable yapiyoruz (Google ile giris icin)
            $table->string('password')->nullable()->change();
        });
    }

    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn([
                'google_id',
                'phone_verified_at',
                'phone_verification_code',
                'phone_verification_expires_at',
                'phone_verification_attempts',
            ]);

            $table->string('password')->nullable(false)->change();
        });
    }
};
