<?php

namespace Database\Seeders;

use App\Classes\ValueObjects\Constants\KVPKey;
use Illuminate\Database\Seeder;
use App\Models\KeyValuePair;


class KeyValuePairSeeder extends Seeder
{
    public function run()
    {
        $data = [
            [
                'key' => KVPKey::UI_PAYMENTS_COMPLETE_CURRENCY_ORDERS_IS_LOCKED,
                'value' => 0,
            ],
            [
                'key' => KVPKey::UI_PAYMENTS_OPEN_CURRENCY_ORDERS_IS_LOCKED,
                'value' => 0,
            ],
            [
                'key' => KVPKey::UI_SUPPLIER_PAID_CURRENCY_ORDER_TAB_IS_LOCKED,
                'value' => 0,
            ],
        ];

        foreach ($data as $item) {
            KeyValuePair::updateOrCreate(
                [
                    'owner_type' => null,
                    'owner_id'   => null,
                    'key'        => $item['key'],
                ],
                [
                    'value' => $item['value'],
                ]
            );
        }
    }
}
