<?php

namespace Database\Seeders;

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

class LoaderCollectionTableSeeder extends Seeder
{
    private $table = 'loader_collection';
    private $langTable = 'loader_collection_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
                ]
            ]
        );

        DB::table($this->langTable)->insert(
            [
                [
                    'translation_id'        => 1,
                    'loader_collection_id'  => 1,
                    'language_id'           => 'en',
                    'title'                 => 'Initial Loader Images',
                    'created_at'            => $now
                ]
            ]
        );

        DB::table($this->websiteTable)->insert(
            [
                [
                    'website_object_id' => 1701,
                    'parent_id'         => null,
                    'object_id'         => 1,
                    'object_type'       => LoaderCollection::class,
                    'content_type'      => 'loaderCollection',
                    'slug'              => 'loaderCollection',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 1,
                    'created_at'        => $now
                ]
            ]
        );

        DB::table($this->websiteLangTable)->insert(
            [
                [
                    'wo_translation_id' => 1701,
                    'website_object_id' => 1701,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'loaderCollection',
                    'lang_uri'          => null,
                ],
            ]
        );
    }
}
