<?php
/*
 * Copyright © 2020 Miguel Nogueira
 *
 *   This file is part of Raspberry Staff Manager.
 *
 *     Raspberry Staff Manager is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     Raspberry Staff Manager is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with Raspberry Staff Manager.  If not, see <https://www.gnu.org/licenses/>.
 */

namespace Database\Seeders;

use App\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;

class UserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $ghostAccount = User::create([
            'uuid' => 'b741345057274a519144881927be0290', // Ghost
            'name' => 'Ghost (deleted account)',
            'email' => 'blackhole@example.com',
            'email_verified_at' => now(),
            'username' => 'ghost',
            'registrationIp' => '0.0.0.0',
            'currentIp' => '0.0.0.0',
            'password' => 'locked',
        ])->assignRole('user'); // There can't be role-less users

        $admin = User::create(([
            'uuid' => 'b741345057274a519144881927be0290', // Ghost
            'name' => 'Admin',
            'email' => 'admin@example.com',
            'email_verified_at' => now(),
            'username' => 'admin',
            'registrationIp' => '0.0.0.0',
            'currentIp' => '0.0.0.0',
            'password' => Hash::make('password'),
        ]))->assignRole('user', 'reviewer', 'hiringManager', 'admin');

        $staff = User::create(([
            'uuid' => 'b741345057274a519144881927be0290', // Ghost
            'name' => 'Admin',
            'email' => 'staffmember@example.com',
            'email_verified_at' => now(),
            'username' => 'staff_user',
            'registrationIp' => '0.0.0.0',
            'currentIp' => '0.0.0.0',
            'password' => Hash::make('password'),
        ]))->assignRole('user', 'reviewer', 'staff');
       

        $endUser = User::create(([
            'uuid' => 'b741345057274a519144881927be0290', // Ghost
            'name' => 'End User',
            'email' => 'enduser@example.com',
            'email_verified_at' => now(),
            'username' => 'admin',
            'registrationIp' => '0.0.0.0',
            'currentIp' => '0.0.0.0',
            'password' => Hash::make('password'),
        ]))->assignRole('user');

        $users = User::factory()
            ->count(60)
            ->create();

        foreach ($users as $user) {
            $user->assignRole('user');
        }
    }
}
