<?php

namespace Database\Seeders;

use App\Models\GenericBackoffice\OpenPositionSpec;
use Illuminate\Database\Seeder;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;

class OpenPositionSpecsTableSeeder extends Seeder
{
    private $table = 'open_position_specs';
    private $langTable = 'open_position_spec_languages';

    private $websiteTable = 'website_objects';
    private $websiteLangTable = 'website_objects_lang';

    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        // Table already deleted in DatabaseSeeder

        $now = Carbon::now();

        DB::table($this->table)->insert(
            [
                [
                    'id'                => 1,
                    'backend_user_id'   => 1,
                    'created_at'        => $now
                ],
                [
                    'id'                => 2,
                    'backend_user_id'   => 1,
                    'created_at'        => $now
                ],
                [
                    'id'                => 3,
                    'backend_user_id'   => 1,
                    'created_at'        => $now
                ]
            ]
        );

        DB::table($this->langTable)->insert(
            [
                [
                    'translation_id'            => 1,
                    'open_position_spec_id'     => 1,
                    'language_id'               => 'en',
                    'title'                     => 'FE Inter - What you will do',
                    'spec_title'                => 'What you will do',
                    'text_wysiwyg'              => "<ul><li>Work closely with a strong and highly motivated multidisciplinary team.</li><li>Build high-quality front-end applications and services.</li><li>Bridge the communication between back-end and front-end.</li><li>Push the team's boundaries by searching new trends and understand them as viable options for our products.</li></ul>",
                    'created_at'                => $now
                ],
                [
                    'translation_id'            => 2,
                    'open_position_spec_id'     => 2,
                    'language_id'               => 'en',
                    'title'                     => 'FE Inter - Main requirements',
                    'spec_title'                => 'Main requirements',
                    'text_wysiwyg'              => "<ul><li>At least 2 years of solid front-end development experience.</li><li>HTML5, CSS3 and JavaScript (ES6) experience.</li><li>Mastering at least one JavaScript framework: Backbone.js, React, AngularJs or Vue.js.</li><li>Experience with Vue.js is a plus.</li><li>Build setup experience (npm, yearn, Gulp, Webpack).</li></ul>",
                    'created_at'                => $now
                ],
                [
                    'translation_id'            => 3,
                    'open_position_spec_id'     => 3,
                    'language_id'               => 'en',
                    'title'                     => 'FE Inter - Nice to have',
                    'spec_title'                => 'Nice to have',
                    'text_wysiwyg'              => "<ul><li>Experience working with Agile methodologies.</li><li>Accessibility knowledge and a keen eye for UI details and implementation.</li><li>Deployment setup tools experience (GIT).</li><li>Hands-on baking skills so you can bring cakes from time to time 🍰</li></ul>",
                    'created_at'                => $now
                ]
            ]
        );

        DB::table($this->websiteTable)->insert(
            [
                [
                    'website_object_id' => 801,
                    'parent_id'         => null,
                    'object_id'         => 1,
                    'object_type'       => OpenPositionSpec::class,
                    'content_type'      => 'openPositionSpec',
                    'slug'              => 'fe-inter-what-you-will-do',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 1,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 802,
                    'parent_id'         => null,
                    'object_id'         => 2,
                    'object_type'       => OpenPositionSpec::class,
                    'content_type'      => 'openPositionSpec',
                    'slug'              => 'fe-inter-main-requirements',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 2,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 803,
                    'parent_id'         => null,
                    'object_id'         => 3,
                    'object_type'       => OpenPositionSpec::class,
                    'content_type'      => 'openPositionSpec',
                    'slug'              => 'fe-inter-nice-to-have',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 3,
                    'created_at'        => $now
                ]
            ]
        );

        DB::table($this->websiteLangTable)->insert(
            [
                [
                    'wo_translation_id' => 801,
                    'website_object_id' => 801,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'fe-inter-what-you-will-do',
                    'lang_uri'          => null,
                ],
                [
                    'wo_translation_id' => 802,
                    'website_object_id' => 802,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'fe-inter-main-requirements',
                    'lang_uri'          => null,
                ],
                [
                    'wo_translation_id' => 803,
                    'website_object_id' => 803,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'fe-inter-nice-to-have',
                    'lang_uri'          => null,
                ]
            ]
        );
    }
}
