<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class SpeciesSurveySeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $u1 = DB::table('users')->where('email', 'aswani@meridian.net.in')->first() ?: DB::table('users')->first();
        $u2 = DB::table('users')->where('email', 'arjun.kt@meridian.net.in')->first() ?: DB::table('users')->skip(2)->first();

        if (!$u1 || !$u2) {
            return;
        }

        DB::table('species_surveys')->truncate();

        $surveys = [
            [
                'user_id' => $u1->id,
                'species_id' => 1,
                'species_name' => '1286-Parastromateus (=Formio) niger(=F. niger)',
                'state_id' => 1,
                'state_name' => 'WEST BENGAL',
                'landing_center_id' => 1,
                'landing_center_name' => 'DIGHA SANKARPUR',
                'user_name' => $u1->name,
                'image' => 'survey1.jpg',
                'image_url' => 'http://localhost/uploads/survey1.jpg',
                'gear_name' => 'Multiday Trawlnet',
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'user_id' => $u1->id,
                'species_id' => 2,
                'species_name' => '1967-Scomberomorus guttatus',
                'state_id' => 1,
                'state_name' => 'WEST BENGAL',
                'landing_center_id' => 1,
                'landing_center_name' => 'DIGHA SANKARPUR',
                'user_name' => $u1->name,
                'image' => 'survey2.jpg',
                'image_url' => 'http://localhost/uploads/survey2.jpg',
                'gear_name' => 'Gillnet',
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'user_id' => $u2->id,
                'species_id' => 3,
                'species_name' => '0316-Tenualosa ilisha (=Hilsa ilisha)',
                'state_id' => 1,
                'state_name' => 'WEST BENGAL',
                'landing_center_id' => 1,
                'landing_center_name' => 'DIGHA SANKARPUR',
                'user_name' => $u2->name,
                'image' => 'survey3.jpg',
                'image_url' => 'http://localhost/uploads/survey3.jpg',
                'gear_name' => 'Gillnet',
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'user_id' => $u2->id,
                'species_id' => 4,
                'species_name' => '095N-Epinephelus coioides',
                'state_id' => 2,
                'state_name' => 'ANDHRA PRADESH',
                'landing_center_id' => 2,
                'landing_center_name' => 'BANDARUVANIPETA',
                'user_name' => $u2->name,
                'image' => 'survey4.jpg',
                'image_url' => 'http://localhost/uploads/survey4.jpg',
                'gear_name' => 'Hooks & Line',
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'user_id' => $u2->id,
                'species_id' => 5,
                'species_name' => '1341-Lutjanus argentimaculatus',
                'state_id' => 2,
                'state_name' => 'ANDHRA PRADESH',
                'landing_center_id' => 3,
                'landing_center_name' => 'CHINNAMYLAVANILANKA',
                'user_name' => $u2->name,
                'image' => 'survey5.jpg',
                'image_url' => 'http://localhost/uploads/survey5.jpg',
                'gear_name' => 'Castnet',
                'created_at' => now(),
                'updated_at' => now(),
            ],
        ];

        DB::table('species_surveys')->insert($surveys);
    }
}
