<?php

declare(strict_types=1);

use Hyperf\Database\Seeders\Seeder;
use App\Models\User;

use Hypervel\Support\Facades\Hash;
use Hypervel\Support\Str;

class UserSeeder extends Seeder
{

    protected $users = [
        [
            'name' => 'Admin Ultima User',
            'mobile_number' => '777',
            'nickname' => 'admin',
            'username' => 'admin',
            'email' => 'admin@example.com',
            'password' => 'OmegaPsilon32!',
            'acct_type' => 'ult',
        ],
        [
            'name' => 'Super Op User',
            'mobile_number' => '09111111111',
            'nickname' => 'superop',
            'username' => 'test_super_op',
            'password' => 'TetraOmega21!',
            'acct_type' => 'super operator',
        ],
        [
            'name' => 'Operator User',
            'mobile_number' => '09222222222',
            'nickname' => 'operator',
            'username' => 'test_op',
            'password' => 'HeliosAlpha21!',
            'acct_type' => 'operator',
        ],
        [
            'name' => 'Coordinator User',
            'mobile_number' => '09333333333',
            'nickname' => 'coordinator',
            'username' => 'test_coord',
            'password' => 'ParagonSigma51!',
            'acct_type' => 'coordinator',
        ],
        [
            'name' => 'Rider User',
            'mobile_number' => '09444444444',
            'nickname' => 'rider',
            'username' => 'test_rider',
            'password' => 'MilipedeAstra21!',
            'acct_type' => 'rider',
        ],
        [
            'name' => 'POS Terminal User',
            'mobile_number' => '09555555555',
            'nickname' => 'pos',
            'username' => 'test_pos',
            'password' => 'MedicusGamma21!',
            'acct_type' => 'pos terminal',
        ],
        [
            'name' => 'Standard User',
            'mobile_number' => '09666666666',
            'nickname' => 'user',
            'username' => 'test_user',
            'password' => 'OrionDraconis21!',
            'acct_type' => 'user',
        ],
    ];

    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        foreach ($this->users as $data) {
            User::firstOrCreate(['mobile_number' => $data['mobile_number']], [
                'name' => $data['name'],
                // 'hashkey' => $data['hashkey'],

                'nickname' => $data['nickname'] ?? null,
                'username' => $data['username'] ?? null,
                'email' => $data['email'] ?? null,
                'email_verified_at' => now(),
                'mobile_verified_at' => now(),
                'password' => Hash::make($data['password']),
                'acct_type' => $data['acct_type'],
                'total_balance' => 0,
                'total_credit' => 0,
                'created_by' => null,
                'updated_by' => null,
                'active' => true,
                'parentuid' => null,
                'targetuids' => null,
                'notes' => null,
                'exec_command' => null,
                'settings' => null,
                'multiple_logins' => false,
                'referralcode' => null,
                'photourl' => null,
                'logs' => null,
                'cart' => null,
            ]);
        }
    }
}

