<?php

use App\Setting;
use Illuminate\Database\Seeder;

class UnsoldCommodityNotificationSettingSeeders extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Setting::where('group', 'unsold_commodity_notifications')->each(fn($x) => $x->delete());

        $data = [
            [
                'key' => 'status',
                'value' => '1',
                'group' =>  'unsold_commodity_notifications',
                'description' => 'Turn on or turn off notification for unsold commodity notifications',
            ],
            [
                'key' => 'start_time',
                'value' =>  '20:00',
                'group' =>  'unsold_commodity_notifications',
                'description' => 'The time the notifications start',
            ],
            [
                'key' => 'end_time',
                'value' =>  '23:00',
                'group' =>  'unsold_commodity_notifications',
                'description' => 'The time the notifications end',
            ],
            [
                'key' => 'message',
                'value' => 'Baki komoditi masih lagi berbaki dan belum habis dijual',
                'group' =>  'unsold_commodity_notifications',
                'description' => 'Turn on or turn off notification for unsold commodity notifications',
            ],
            [
                'key' => 'pic_sunday',
                'value' => '[{}]',
                'group' =>  'unsold_commodity_notifications',
                'description' => 'Person Incharge on Sunday',
            ],
            [
                'key' => 'pic_monday',
                'value' => '[{}]',
                'group' =>  'unsold_commodity_notifications',
                'description' => 'Person Incharge on Monday',
            ],
            [
                'key' => 'pic_tuesday',
                'value' => '[{}]',
                'group' =>  'unsold_commodity_notifications',
                'description' => 'Person Incharge on Tuesday',
            ],
            [
                'key' => 'pic_wednesday',
                'value' => '[{}]',
                'group' =>  'unsold_commodity_notifications',
                'description' => 'Person Incharge on Wednesday',
            ],
            [
                'key' => 'pic_thursday',
                'value' => '[{}]',
                'group' =>  'unsold_commodity_notifications',
                'description' => 'Person Incharge on Thursday',
            ],
            [
                'key' => 'pic_friday',
                'value' => '[{}]',
                'group' =>  'unsold_commodity_notifications',
                'description' => 'Person Incharge on Friday',
            ],
            [
                'key' => 'pic_saturday',
                'value' => '[{}]',
                'group' =>  'unsold_commodity_notifications',
                'description' => 'Person Incharge on Saturday',
            ],

        ];

        array_walk($data, function ($setting) {
            Setting::create($setting);
        });
    }
}
