<?php

namespace Database\Factories;

use App\Models\SystemSetting;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

/** @extends Factory<SystemSetting> */
class SystemSettingFactory extends Factory
{
    protected $model = SystemSetting::class;

    public function definition(): array
    {
        return [
            'uuid' => (string) Str::uuid(),
            'setting_group' => 'general',
            'setting_key' => 'example_'.Str::lower(Str::random(8)),
            'setting_value' => fake()->word(),
            'setting_type' => 'string',
            'description' => fake()->sentence(),
            'is_public' => false,
            'is_encrypted' => false,
        ];
    }

    public function secret(): static
    {
        return $this->state(fn (): array => [
            'setting_group' => 'integrations',
            'setting_type' => 'secret',
            'is_public' => false,
            'is_encrypted' => true,
        ]);
    }
}
