<?php

namespace Database\Seeders;

use App\Models\Role;
use App\Models\User;
use Illuminate\Database\Seeder;

class RoleSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $root = Role::create([
            'name' => 'root',
            'display_name' => 'Root', // optional
            'description' => 'Highest level of role', // optional
        ]);

        $developer = Role::create([
            'name' => 'developer',
            'display_name' => 'Developer', // optional
            'description' => 'Highest level of role', // optional
        ]);

        $admin = Role::create([
            'name' => 'admin',
            'display_name' => 'Administrator', // optional
            'description' => 'User is allowed to manage and edit anything in application', // optional
        ]);

        $profitCenter = Role::create([
            'name' => 'profit-center',
            'display_name' => 'ProfitCenter', // optional
            'description' => 'User is allowed to manage own orders', // optional
        ]);

        /*        if($user=User::where('name','developer')->first()){
                    $user->attachRole($root);
                };
                if($user=User::where('name','testAdmin')->first()){
                    $user->attachRole($admin);
                };

                if($user=User::where('name','testProfitCenter')->first()){
                    $user->attachRole($profitCenter);
                };*/

    }
}
