<?php

namespace Database\Seeders\Global;

use App\Models\ExportMapTemplate;
use Illuminate\Database\Seeder;

class YallamotorExportMapTemplateSeed extends Seeder
{
    public function run(): void
    {
        ExportMapTemplate::updateOrCreate(
            [
                'title' => 'Yallamotor JSON feed',
            ],
            [
                'is_published' => true,
                'sales_channel' => 'yallamotor',
                'type' => 'vehicle',
                'format' => 'json',
                'columns' => [
                    'uuid',
                    'make.name',
                    'model.name',
                    'trim',
                    'manufacture_year',
                    'price',
                    'odometer_km',
                    'dealership.city',
                    'colour',
                    'description',
                    'bodyStyle.name',
                    'drivetrain.name',
                    'transmission.name',
                    'fuelType.name',
                    'condition',
                    'door_count',
                    'seats',
                    'engine_size_cc',
                    'dealership.contact_no',
                    'site_url',
                    'images20',
                    'features.name',
                    'featured',
                ],
                'headers' => [
                    'ad_reference',
                    'make',
                    'model',
                    'trim',
                    'year',
                    'price',
                    'km_driven',
                    'city',
                    'color',
                    'description_en',
                    'body_type',
                    'drive_type',
                    'transmission',
                    'fuel_type',
                    'condition_type',
                    'doors',
                    'number_of_seats',
                    'engine_size',
                    'mobile_number',
                    'external_link',
                    'photos',
                    'features',
                    'featured',
                ],
                'config' => [
                    'json_envelope' => '{ "results": "__RESULTS__" }',
                    'column_types' => [
                        'string',
                        'string',
                        'string',
                        'string',
                        'number',
                        'string',
                        'number',
                        'string',
                        'string',
                        'string',
                        'string',
                        'string',
                        'string',
                        'string',
                        'string',
                        'number',
                        'number',
                        'number',
                        'string',
                        'string',
                        'array_of_objects',
                        'array_of_strings',
                        'boolean',
                    ],
                    'column_paths' => [
                        null, null, null, null, null,
                        null, null, null, null, null,
                        null, null, null, null, null,
                        null, null, null, null, null,
                        'path', null, null,
                    ],
                ],
                'mapping_rules' => [],
            ]
        );
    }
}
