<?php

namespace App\FieldVisibility;

/**
 * Field/tab catalogue for the admin offer edit page.
 *
 * Lockable keys are the ones UpdateVehicleOfferRequest enforces as mandatory.
 * Only `name` is a mandatory field on the edit form (featured/published are
 * sidebar toggles, not catalogued fields); everything else may be hidden.
 */
class OfferFieldCatalogue extends AbstractFieldCatalogue
{
    public const ENTITY = 'offer';

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

    public function groups(): array
    {
        return [
            ['key' => 'details', 'label' => 'Offer details'],
            ['key' => 'pricing', 'label' => 'Pricing'],
            ['key' => 'battery', 'label' => 'Battery'],
            ['key' => 'content', 'label' => 'Content'],
            ['key' => 'ctas', 'label' => 'CTAs'],
            ['key' => 'tabs', 'label' => 'Tabs'],
        ];
    }

    public function fields(): array
    {
        return [
            // Offer details
            $this->field('name', 'Name', 'details', lockable: true),
            $this->field('type_id', 'Offer Type', 'details'),
            $this->field('new_car_type', 'New Car Type', 'details'),
            $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('publish_date', 'Publish date', 'details'),
            $this->field('unpublish_date', 'Unpublish date', 'details'),
            $this->field('weight', 'Priority Weight', 'details'),
            $this->field('vehicle_type', 'Vehicle Type', 'details'),
            $this->field('make_id', 'Make', 'details'),
            $this->field('model_id', 'Model', 'details'),
            $this->field('new_car_id', 'New Vehicle', 'details'),
            $this->field('trim_id', 'Trim (linked)', 'details'),
            $this->field('derivative', 'Derivative', 'details'),
            $this->field('trim', 'Trim', 'details'),
            $this->field('colour', 'Colour', 'details'),
            $this->field('engine_size_cc', 'Engine size (cc)', 'details'),
            $this->field('co2', 'CO2', 'details'),
            $this->field('transmission_id', 'Transmission', 'details'),
            $this->field('drivetrain_id', 'Drivetrain', 'details'),
            $this->field('body_style_id', 'Body style', 'details'),
            $this->field('fuel_type_id', 'Fuel type', 'details'),
            $this->field('mpg', 'MPG', 'details'),
            $this->field('youtube_video', 'Video URL', 'details'),
            $this->field('cap_id', 'Cap ID', 'details'),

            // Pricing
            $this->field('price', 'Cash Price from', 'pricing'),
            $this->field('full_price', 'Full Price', 'pricing'),
            $this->field('deposit', 'Deposit', 'pricing'),

            // Battery
            $this->field('battery_range', 'Battery Range', 'battery'),
            $this->field('battery_capacity_kwh', 'Battery Capacity KWH', 'battery'),
            $this->field('battery_usable_capacity_kwh', 'Battery Usable Capacity KWH', 'battery'),
            $this->field('battery_charge_time', 'Battery Charge Time', 'battery'),
            $this->field('battery_quick_charge_time', 'Battery Quick Charge Time', 'battery'),
            $this->field('battery_quick_charge_level', 'Battery Quick Charge Level', 'battery'),

            // Content
            $this->field('description', 'Description', 'content'),
            $this->field('t_and_cs', 'T&Cs', 'content'),
            $this->field('key_features', 'Key Features', 'content'),
            $this->field('standard_spec', 'Standard Spec', 'content'),
            $this->field('technical_spec', 'Technical Spec', 'content'),
            $this->field('label', 'Label', 'content'),
            $this->field('excerpt', 'Excerpt', 'content'),

            // CTAs
            $this->field('cta_button1_label', 'CTAs Button 1 Label', 'ctas'),
            $this->field('cta_button1_url', 'CTAs Button 1 URL', 'ctas'),
            $this->field('cta_button2_label', 'CTAs Button 2 Label', 'ctas'),
            $this->field('cta_button2_url', 'CTAs Button 2 URL', 'ctas'),
            $this->field('footnote', 'CTAs Footnote', 'ctas'),

            // Tabs
            $this->field('tab_media', 'Media tab', 'tabs'),
            $this->field('tab_content', 'Content tab', 'tabs'),
            $this->field('tab_key_features', 'Key features tab', 'tabs'),
            $this->field('tab_tech_specs', 'Technical specs tab', 'tabs'),
            $this->field('tab_equipment', 'Equipment 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'),
        ];
    }
}
