<?php

namespace Database\Seeders;

use App\Models\Gallery;
use App\Settings\GeneralSettings;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;

class GallerySeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        /** @var \App\Settings\GeneralSettings $settings */
        $settings = app(GeneralSettings::class);

        Gallery::firstOrCreate(
            ['images_path' => 'uploads'],
            [
                'slug' => Str::uuid()->toString(),
                'name' => 'Default Gallery',
                'title' => $settings->gallery_heading ?? 'Style Gallery',
                'is_public' => true,
                'allow_ai_styles' => true,
                'allow_print' => true,
                'require_password' => (bool) $settings->require_gallery_password,
                'password_hash' => $settings->gallery_password_hash,
                'expires_at' => $settings->gallery_expires_at,
                'access_duration_minutes' => $settings->gallery_access_duration_minutes,
                'upload_enabled' => false,
                'upload_token_hash' => null,
                'upload_token_expires_at' => null,
                'sparkbooth_username' => null,
                'sparkbooth_password' => null,
                'sparkbooth_response_format' => 'json',
            ]
        );
    }
}
