<?php

namespace Database\Seeders;

use App\Models\RequestType;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;

class RequestTypeSeeder extends Seeder
{
    public function run(): void
    {
        $types = [
            ['name' => 'Just Listed', 'requires_url' => true, 'supports_campaign' => false, 'order' => 1],
            ['name' => 'Just Sold', 'requires_url' => true, 'supports_campaign' => false, 'order' => 2],
            ['name' => 'Auction', 'requires_url' => true, 'supports_campaign' => false, 'order' => 3],
            ['name' => 'Open Home', 'requires_url' => true, 'supports_campaign' => false, 'order' => 4],
            ['name' => 'Price Change', 'requires_url' => true, 'supports_campaign' => false, 'order' => 5],
            ['name' => 'Deadline / Date Change', 'requires_url' => true, 'supports_campaign' => false, 'order' => 6],
            ['name' => 'Paid Advertising Campaign', 'requires_url' => true, 'supports_campaign' => true, 'order' => 7],
            ['name' => 'Social Media Creative', 'requires_url' => false, 'supports_campaign' => false, 'order' => 8],
            ['name' => 'Existing Creative Update', 'requires_url' => false, 'supports_campaign' => false, 'order' => 9],
            ['name' => 'Other Marketing Requests', 'requires_url' => false, 'supports_campaign' => false, 'order' => 10],
        ];

        foreach ($types as $t) {
            RequestType::updateOrCreate(
                ['slug' => Str::slug($t['name'])],
                [
                    'name' => $t['name'],
                    'active' => true,
                    'requires_property_url' => $t['requires_url'],
                    'supports_campaign_fields' => $t['supports_campaign'],
                    'sort_order' => $t['order'],
                ]
            );
        }
    }
}
