<?php

namespace Database\Seeders;

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

class SettingSeeder extends Seeder
{
    public function run(): void
    {
        $settings = [
            [
                'key' => 'business_name',
                'value' => 'INVENTINO Store',
                'type' => 'string',
                'description' => 'Business name for invoices and receipts',
            ],
            [
                'key' => 'business_logo',
                'value' => null,
                'type' => 'string',
                'description' => 'Business logo path for receipts (optional)',
            ],
            [
                'key' => 'business_address',
                'value' => '123 Business Street, City, Country',
                'type' => 'string',
                'description' => 'Business address',
            ],
            [
                'key' => 'business_phone',
                'value' => '+1234567890',
                'type' => 'string',
                'description' => 'Business contact phone',
            ],
            [
                'key' => 'business_email',
                'value' => 'contact@inventino.shop',
                'type' => 'string',
                'description' => 'Business contact email',
            ],
            [
                'key' => 'tax_rate',
                'value' => '0.15',
                'type' => 'string',
                'description' => 'Tax rate (e.g., 0.15 for 15%)',
            ],
            [
                'key' => 'currency_symbol',
                'value' => '$',
                'type' => 'string',
                'description' => 'Currency symbol',
            ],
            [
                'key' => 'currency_code',
                'value' => 'USD',
                'type' => 'string',
                'description' => 'Currency code',
            ],
            [
                'key' => 'low_stock_threshold',
                'value' => '10',
                'type' => 'integer',
                'description' => 'Default low stock threshold',
            ],
            [
                'key' => 'invoice_prefix',
                'value' => 'INV',
                'type' => 'string',
                'description' => 'Invoice number prefix',
            ],
            [
                'key' => 'receipt_footer',
                'value' => 'Thank you for your business!',
                'type' => 'string',
                'description' => 'Message at bottom of receipts',
            ],
            [
                'key' => 'enable_loyalty_points',
                'value' => '1',
                'type' => 'boolean',
                'description' => 'Enable customer loyalty points',
            ],
            [
                'key' => 'loyalty_enabled',
                'value' => '1',
                'type' => 'boolean',
                'description' => 'Enable customer loyalty points program',
            ],
            [
                'key' => 'loyalty_points_per_unit',
                'value' => '1',
                'type' => 'string',
                'description' => 'Points earned per 1 unit of currency spent',
            ],
            [
                'key' => 'loyalty_point_value',
                'value' => '0.50',
                'type' => 'string',
                'description' => 'Monetary value of each loyalty point (e.g. 0.50 = ₦0.50 per point)',
            ],
        ];

        foreach ($settings as $setting) {
            Setting::updateOrCreate(
                ['key' => $setting['key']],
                $setting
            );
        }
    }
}
