<?php

namespace Database\Seeders;

// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Database\Seeders\JawabanSeeder;
use Database\Seeders\OrganismSeeder;
use Database\Seeders\SirabSeeder;
use App\User;
 
class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     */
    public function run(): void
    {
        $ceksudah = User::where('username', 'admin')->count();
        if ($ceksudah == 0){
            User::create([
                'nama'      	=>  'Administrator',
                'username' 		=>  'admin',
                'password' 		=>  bcrypt('semangat'),
                'previlage' 	=> 	'developer',
            ]);
        }
        $json1 = file_get_contents(database_path('seeders/data/ruangan.json'));
        $data1 = json_decode($json1, true);
        DB::table('ruangan')->insert($data1);
        $this->call(JawabanSeeder::class);
        $this->call(OrganismSeeder::class);
        $this->call(SirabSeeder::class);
        DB::table('poli')->insert([
            ['poli' => 'Mikrobiologi', 'subpoli' => '10  SPUTUM - 10 3 4 KULTUR AEROB SPUTUM DAN UJI KEPEKAAN AB', 'subsubpoli' => '', 'modaliti' => '', 'modaliti2' => ''],
            ['poli' => 'Mikrobiologi', 'subpoli' => '2.3.5 KULTUR AEROB SEKRET DAN UJI KEPEKAAN AB', 'subsubpoli' => '', 'modaliti' => '', 'modaliti2' => ''],
            ['poli' => 'Mikrobiologi', 'subpoli' => '1.3.1 PEWARNAAN GRAM URINE', 'subsubpoli' => '', 'modaliti' => '', 'modaliti2' => ''],
            ['poli' => 'Mikrobiologi', 'subpoli' => '7.3.1 PEWARNAAN GRAM SWAB TELINGA', 'subsubpoli' => '', 'modaliti' => '', 'modaliti2' => ''],
            ['poli' => 'Mikrobiologi', 'subpoli' => '8.3.1 PEWARNAAN GRAM SPESIMEN MATA', 'subsubpoli' => '', 'modaliti' => '', 'modaliti2' => ''],
            ['poli' => 'Mikrobiologi', 'subpoli' => '1.3.4 KULTUR AEROP URINE DAN UJI KEPEKAAN AB', 'subsubpoli' => '', 'modaliti' => '', 'modaliti2' => ''],
            ['poli' => 'Mikrobiologi', 'subpoli' => '4.3.3 KULTUR DARAH AEROB DEWASA 1 BOTOL DAN UJI KEPEKAAN AB', 'subsubpoli' => '', 'modaliti' => '', 'modaliti2' => ''],
            ['poli' => 'Mikrobiologi', 'subpoli' => '4.3.7 KULTUR JAMUR DARAH', 'subsubpoli' => '', 'modaliti' => '', 'modaliti2' => ''],
            ['poli' => 'Mikrobiologi', 'subpoli' => '5.3.1 PEWARNAAN GRAM SWAB TENGGOROK', 'subsubpoli' => '', 'modaliti' => '', 'modaliti2' => ''],
            ['poli' => 'Mikrobiologi', 'subpoli' => '5.3.2 PEWARNAAN NEISSER SWAB TENGGOROK', 'subsubpoli' => '', 'modaliti' => '', 'modaliti2' => ''],
            ['poli' => 'Mikrobiologi', 'subpoli' => '5.3.4 KULTUR AEROB SWAB TENGGOROK DAN UJI KEPEKAAN AB', 'subsubpoli' => '', 'modaliti' => '', 'modaliti2' => ''],
            ['poli' => 'Mikrobiologi', 'subpoli' => '10.3.4 KULTUR AEROB SPUTUM DAN UJI KEPEKAAN AB', 'subsubpoli' => '', 'modaliti' => '', 'modaliti2' => ''],
            ['poli' => 'Mikrobiologi', 'subpoli' => '4.3.5 KULTUR DARAH AEROB PEDIATRI 1 BOTOL DAN UJI KEPEKAAN AB', 'subsubpoli' => '', 'modaliti' => '', 'modaliti2' => ''],
        ]);
    }
}
