<?php

namespace Database\Seeders;

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

class SectionTypeSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        // Comprobar si la tabla ya tiene datos
        $count = DB::table('section_type')->count();

        if ($count == 0) {
            // Lista de tipos de secciones a insertar
            $sectionTypes = [
                [
                    'id' => '011ecee7d295c066ae68d4396215c3d0',
                    'section_type_id' => '28c8edde3d61a0411511d3b1866f0636',
                    'key' => 'BDEV',
                    'value' => 'Developer_Background',
                    'created_at' => '2022-09-05 23:20:26',
                    'position' => '4',
                    'updated_at' => null
                ],
                [
                    'id' => '28c8edde3d61a0411511d3b1866f0636',
                    'section_type_id' => null,
                    'key' => 'BACK',
                    'value' => 'Background',
                    'created_at' => '2022-09-05 23:16:07',
                    'position' => '0',
                    'updated_at' => null
                ],
                [
                    'id' => '38026ed22fc1a91d92b5d2ef93540f20',
                    'section_type_id' => '28c8edde3d61a0411511d3b1866f0636',
                    'key' => 'BPTA',
                    'value' => 'Perinatal_Background',
                    'created_at' => '2022-09-05 23:18:28',
                    'position' => '2',
                    'updated_at' => null
                ],
                [
                    'id' => '3d2f8900f2e49c02b481c2f717aa9020',
                    'section_type_id' => '28c8edde3d61a0411511d3b1866f0636',
                    'key' => 'BINM',
                    'value' => 'Immunizations_Background',
                    'created_at' => '2022-09-05 23:25:51',
                    'position' => '6',
                    'updated_at' => null
                ],
                [
                    'id' => '4c0d13d3ad6cc317017872e51d01b238',
                    'section_type_id' => '28c8edde3d61a0411511d3b1866f0636',
                    'key' => 'SALM',
                    'value' => 'Alimentation',
                    'created_at' => '2022-09-05 23:30:32',
                    'position' => '3',
                    'updated_at' => null
                ],
                [
                    'id' => '4e44f1ac85cd60e3caa56bfd4afb675e',
                    'section_type_id' => '28c8edde3d61a0411511d3b1866f0636',
                    'key' => 'BPSI',
                    'value' => 'Psychobiology_Background',
                    'created_at' => '2022-09-05 23:23:03',
                    'position' => '5',
                    'updated_at' => null
                ],
                [
                    'id' => '665f644e43731ff9db3d341da5c827e1',
                    'section_type_id' => '28c8edde3d61a0411511d3b1866f0636',
                    'key' => 'BPER',
                    'value' => 'Personal_Background',
                    'created_at' => '2022-09-05 23:17:13',
                    'position' => '7',
                    'updated_at' => null
                ],
                [
                    'id' => '7bfc85c0d74ff05806e0b5a0fa0c1df1',
                    'section_type_id' => '28c8edde3d61a0411511d3b1866f0636',
                    'key' => 'BOTA',
                    'value' => 'Obstetric_Background',
                    'created_at' => '2022-09-11 01:42:05',
                    'position' => '1',
                    'updated_at' => null
                ],
                [
                    'id' => '815e6212def15fe76ed27cec7a393d59',
                    'section_type_id' => '28c8edde3d61a0411511d3b1866f0636',
                    'key' => 'BFAM',
                    'value' => 'Family_Background',
                    'created_at' => '2022-09-05 23:29:31',
                    'position' => '8',
                    'updated_at' => null
                ],
                [
                    'id' => '8d8e353b98d5191d5ceea1aa3eb05d43',
                    'section_type_id' => null,
                    'key' => 'ANTR',
                    'value' => 'Nutritional_Score',
                    'created_at' => '2022-09-05 23:31:28',
                    'position' => '9',
                    'updated_at' => null
                ]
            ];

            // Insertar los datos en la tabla
            DB::table('section_type')->insert($sectionTypes);
            
            $this->command->info('Datos de section_type insertados correctamente.');
        } else {
            $this->command->info('La tabla section_type ya tiene datos. No se realizaron inserciones.');
        }
    }
} 