<?php

declare(strict_types=1);

use Hyperf\Database\Schema\Blueprint;
use Hypervel\Database\Migrations\Migration;
use Hypervel\Support\Facades\Schema;

return new class extends Migration {
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('fullname')->nullable();
            $table->string('hashkey', 300)->unique();
            $table->string('mobile_number');
            $table->string('landline')->nullable();
            $table->string('nickname')->nullable();
            $table->string('username')->unique()->nullable();
            $table->string('email')->unique()->nullable();
            $table->timestamp('email_verified_at')->nullable();
            $table->timestamp('mobile_verified_at')->nullable();
            $table->string('password');
            $table->string('acct_type');
            $table->unsignedBigInteger('total_balance')->default(0);
            $table->bigInteger('total_credit')->default(0);
            $table->bigInteger('created_by')->constrained('users', 'id')->nullable();
            $table->bigInteger('updated_by')->constrained('users', 'id')->nullable();
            $table->boolean('active')->default(true);
            $table->bigInteger('parentuid')->constrained('users', 'id')->nullable();
            $table->json('targetuids')->nullable();
            $table->text('notes')->nullable();
            $table->text('exec_command')->nullable();
            $table->json('settings')->nullable();
            $table->boolean('multiple_logins')->default(false);
            $table->string('referralcode', 150)->nullable();
            $table->json('photourl')->nullable();
            $table->json('logs')->nullable();
            $table->json('cart')->nullable();
            $table->json('details')->nullable();
            $table->json('additional_roles')->json()->nullable();
            $table->json('denied_roles')->json()->nullable();
            $table->timestamps();
        });
    }




    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('users');
    }
};
