<?php

declare(strict_types=1);

namespace Database\Seeders;

use App\Models\Tag;
use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;

class TagsTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $admin = User::role('admin')->first();

        $tags = [
            ['name' => 'گاو شیری', 'en_name' => 'Dairy Cattle'],
            ['name' => 'گاو گوشتی', 'en_name' => 'Beef Cattle'],
            ['name' => 'گوسفند', 'en_name' => 'Sheep'],
            ['name' => 'بز', 'en_name' => 'Goat'],
            ['name' => 'مرغ', 'en_name' => 'Poultry'],
            ['name' => 'دامپزشکی', 'en_name' => 'Veterinary'],
            ['name' => 'تغذیه دام', 'en_name' => 'Animal Feed'],
            ['name' => 'زنبور عسل', 'en_name' => 'Beekeeping'],
            ['name' => 'آبزیان', 'en_name' => 'Aquaculture'],
            ['name' => 'پرواربندی', 'en_name' => 'Fattening'],
        ];

        foreach ($tags as $tag) {
            Tag::firstOrCreate(
                ['slug' => Str::slug($tag['en_name'])],
                [
                    'name' => $tag['name'],
                    'created_by' => $admin?->id,
                ]
            );
        }
    }
}
