<?php

use StoutLogic\AcfBuilder\FieldsBuilder;

$SiteSettings = new FieldsBuilder('Options Site Settings');

$SiteSettings
    ->addGroup('Company Details', [
        'layout' => 'block',
    ])
    ->addText('Company Name')
    ->addText('Trading Name')
    ->addText('Tagline')
    ->addTextarea('Address', [
        'rows' => 3,
        'new_lines' => 'br',
    ])
    ->addText('Phone number')
    ->addEmail('Primary Email')
    ->addText('Company Number')
    ->addText('VAT number')
    ->endGroup();

$SiteSettings
    ->addGroup('Social Accounts', [
        'layout' => 'block',
        'instructions' => 'Used by the footer “Social” column and “Include social links?” toggles.',
    ])
    ->addRepeater('accounts', [
        'layout' => 'row',
        'button_label' => 'Add social account',
        'min' => 0,
    ])
    ->addSelect('platform', [
        'label' => 'Platform',
        'choices' => [
            'facebook' => 'Facebook',
            'instagram' => 'Instagram',
            'linkedin' => 'LinkedIn',
            'x' => 'X (Twitter)',
            'youtube' => 'YouTube',
            'tiktok' => 'TikTok',
        ],
        'ui' => 1,
        'required' => 1,
    ])
    ->addUrl('url', [
        'label' => 'Profile URL',
        'required' => 1,
    ])
    ->addTrueFalse('new_tab', [
        'label' => 'Open in new tab?',
        'ui' => 1,
        'default_value' => 1,
    ])
    ->endRepeater()
    ->endGroup();

$SiteSettings->setLocation('options_page', '==', 'general-settings');

return $SiteSettings->build();