<?php

namespace App\FieldVisibility;

/**
 * Field/tab catalogue for the admin new car edit page.
 *
 * Lockable keys are the ones UpdateNewCarRequest enforces as mandatory
 * (name, make_id, model_id); everything else may be hidden.
 */
class NewCarFieldCatalogue extends AbstractFieldCatalogue
{
    public const ENTITY = 'new-car';

    public function entity(): string
    {
        return self::ENTITY;
    }

    public function groups(): array
    {
        return [
            ['key' => 'details', 'label' => 'Vehicle details'],
            ['key' => 'price', 'label' => 'Price'],
            ['key' => 'content', 'label' => 'Content'],
            ['key' => 'tabs', 'label' => 'Tabs'],
        ];
    }

    public function fields(): array
    {
        return [
            // Vehicle details
            $this->field('name', 'Name', 'details', lockable: true),
            $this->field('template_id', 'Content Template', 'details'),
            $this->field('form_id', 'Enquiry Form', 'details'),
            $this->field('test_drive_form_id', 'Test Drive Form', 'details'),
            $this->field('vehicle_type', 'Vehicle Type', 'details'),
            $this->field('make_id', 'Make', 'details', lockable: true),
            $this->field('model_id', 'Model', 'details', lockable: true),
            $this->field('derivative', 'Derivative', 'details'),
            $this->field('colour', 'Colour', 'details'),
            $this->field('engine_size_cc', 'Engine size (cc)', 'details'),
            $this->field('transmission_id', 'Transmission', 'details'),
            $this->field('drivetrain_id', 'Drivetrain', 'details'),
            $this->field('body_style_id', 'Body style', 'details'),
            $this->field('fuel_types', 'Fuel type', 'details'),
            $this->field('brochure_url', 'Brochure URL', 'details'),

            // Price
            $this->field('price', 'Price from', 'price'),
            $this->field('monthly_price', 'Monthly price from', 'price'),

            // Content
            $this->field('excerpt', 'Excerpt', 'content'),

            // Tabs
            $this->field('tab_trims', 'Trims tab', 'tabs'),
            $this->field('tab_content', 'Content tab', 'tabs'),
            $this->field('tab_finance', 'Finance tab', 'tabs'),
            $this->field('tab_seo', 'SEO tab', 'tabs'),
            $this->field('tab_change_log', 'Change log tab', 'tabs'),
            $this->field('tab_stats', 'Stats / Ad performance tab', 'tabs'),
        ];
    }
}
