<?php

namespace App\FieldVisibility;

/**
 * Field/tab catalogue for the admin dealership edit page.
 *
 * Lockable keys are the ones UpdateDealershipRequest enforces as mandatory
 * (name, contact_no, country); everything else may be hidden.
 */
class DealershipFieldCatalogue extends AbstractFieldCatalogue
{
    public const ENTITY = 'dealership';

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

    public function groups(): array
    {
        return [
            ['key' => 'details', 'label' => 'Details'],
            ['key' => 'address', 'label' => 'Address'],
            ['key' => 'tabs', 'label' => 'Tabs'],
        ];
    }

    public function fields(): array
    {
        return [
            // Details
            $this->field('name', 'Name', 'details', lockable: true),
            $this->field('active', 'Active (view on site)', 'details'),
            $this->field('location_stock', 'Dealership Stock ID', 'details'),
            $this->field('email', 'Email', 'details'),
            $this->field('reservation_team_emails', 'Reservation Team Emails', 'details'),
            $this->field('contact_no', 'Phone Number', 'details', lockable: true),
            $this->field('contact_form_id', 'Contact Form', 'details'),
            $this->field('external_showroom_url', 'External Showroom URL', 'details'),
            $this->field('notes', 'Notes', 'details'),
            $this->field('template_id', 'Content Template', 'details'),

            // Address
            $this->field('address1', 'Address Line 1', 'address'),
            $this->field('address2', 'Address Line 2', 'address'),
            $this->field('city', 'City', 'address'),
            $this->field('county', 'County', 'address'),
            $this->field('postcode', 'Postcode', 'address'),
            $this->field('country', 'Country', 'address', lockable: true),
            $this->field('timezone', 'Timezone', 'address'),
            $this->field('coordinates', 'Coordinates', 'address'),

            // Tabs
            $this->field('tab_departments', 'Departments & holidays tab', 'tabs'),
            $this->field('tab_seo', 'SEO tab', 'tabs'),
            $this->field('tab_content', 'Content tab', 'tabs'),
        ];
    }
}
