<?php

namespace Database\Seeders\Tenant;

use App\Facades\Settings;
use Illuminate\Database\Seeder;

class FreeReservationSettingSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        collect($this->data())
            ->each(fn ($setting) => Settings::make($setting));
    }

    private function data(): array
    {
        return [
            [
                'tab' => 'Automotive',
                'section' => 'Sales',
                'group' => 'General',
                'name' => 'Offer Free Reservations',
                'config_key' => 'sales-reservation-free-enabled',
                'type' => 'boolean',
                'value' => false,
                'description' => 'Allow customers to place a free, time-limited reservation on a vehicle',
            ],
            [
                'tab' => 'Automotive',
                'section' => 'Sales',
                'group' => 'General',
                'name' => 'Free Reservation Expiry Time',
                'config_key' => 'sales-reservation-free-expiry-time',
                'type' => 'string',
                'value' => '12:00',
                'description' => 'Time of day (24 hour, HH:MM) a free reservation expires on its expiry date',
                'validation_rules' => [
                    'date_format:H:i',
                ],
            ],
            [
                'tab' => 'Automotive',
                'section' => 'Sales',
                'group' => 'General',
                'name' => 'Free Reservations Do Not Expire On Sundays',
                'config_key' => 'sales-reservation-free-skip-sundays',
                'type' => 'boolean',
                'value' => true,
                'description' => 'Roll a free reservation expiry forward when it would otherwise fall on a Sunday',
            ],
            [
                'tab' => 'Automotive',
                'section' => 'Sales',
                'group' => 'General',
                'name' => 'Free Reservation Reminder Window (Minutes)',
                'config_key' => 'sales-reservation-free-reminder-window-minutes',
                'type' => 'int',
                'value' => 90,
                'description' => 'How many minutes before a free reservation expires to send the customer a '
                    . 'reminder email. The reminder is sent on the first scheduled run within this window.',
                'validation_rules' => [
                    'integer',
                    'min:1',
                ],
            ],
        ];
    }
}
