<?php
namespace verbb\formie\web\assets\forms;

use craft\web\AssetBundle;
use craft\web\assets\cp\CpAsset as CraftCpAsset;
use craft\web\View;

use verbb\base\assetbundles\CpAsset as VerbbCpAsset;

class FormsAsset extends AssetBundle
{
    // Public Methods
    // =========================================================================

    public function init(): void
    {
        $this->sourcePath = '@verbb/formie/web/assets/forms/dist';

        $this->depends = [
            VerbbCpAsset::class,
            CraftCpAsset::class,
        ];

        parent::init();
    }

    public function registerAssetFiles($view): void
    {
        parent::registerAssetFiles($view);

        if ($view instanceof View) {
            $view->registerTranslations('formie', [
                '"Add as a new field" to make a new field from a copy the original field. Or, "Add as a synced field" to keep the field synchronized to the original field, reflecting any changes to that field.',
                'Add Column After',
                'Add Column Before',
                'Add Existing Field',
                'Add Existing Notification',
                'Add Row After',
                'Add Row Before',
                'Add as new field',
                'Add {num} as new field',
                'Add {num} as new fields',
                'Add as synced field',
                'Add {num} as synced field',
                'Add {num} as synced fields',
                'Add attributes to be output on the form buttons `input` elements.',
                'Add attributes to be output on the form buttons container.',
                'Add classes that will be output on the form buttons container.',
                'Add event data to be sent to Google Tag Manager.',
                'Add existing fields',
                'Add notification',
                'Add rule',
                'Advanced',
                'Align Center',
                'Align Justify',
                'Align Left',
                'Align Right',
                'All',
                'Always Opt-in',
                'An error occurred.',
                'Any',
                'Appearance',
                'Are you sure you want to delete this form?',
                'Are you sure you want to leave?',
                'At least one field is required.',
                'Back Button Label',
                'Back',
                'Bcc:',
                'Blockquote',
                'Bold',
                'Bulk Add Options',
                'Bulk add options',
                'Bullet List',
                'Button Label',
                'Button',
                'CSS Classes',
                'Cc:',
                'Center (Save on Left)',
                'Center (Save on Right)',
                'Center',
                'Checkbox',
                'Clear Format',
                'Code Block',
                'Color',
                'Condition',
                'Conditions',
                'Container Attributes',
                'Date',
                'Default',
                'Define the available options.',
                'Delete Column',
                'Delete Row',
                'Delete Table',
                'Delete',
                'Don’t Include',
                'Drag and drop a field here',
                'Dropdown Options',
                'Dropdown',
                'Duplicate',
                'Edit Field',
                'Edit Link',
                'Edit Notification',
                'Edit Pages',
                'Edit',
                'Email Preview',
                'Email sent successfully. Please check your email.',
                'Email',
                'Enable Conditions',
                'Enable JavaScript Events',
                'Error sending test email.',
                'Existing fields',
                'Field',
                'Fields',
                'Form Buttons Position',
                'Form Field',
                'Form Name',
                'Form saved.',
                'Formatting',
                'Forms',
                'From:',
                'General',
                'Google Tag Manager Event Data',
                'Handle must be unique.',
                'Heading 1',
                'Heading 2',
                'Heading 3',
                'Heading 4',
                'Heading 5',
                'Heading 6',
                'Heading',
                'Hide',
                'Highlight',
                'Horizontal Rule',
                'How the form buttons should be positioned.',
                'I want to',
                'ID',
                'Inline Code',
                'Input Attributes',
                'Insert Link',
                'Insert Table',
                'Italic',
                'Left & Right',
                'Left',
                'Line Break',
                'Link',
                'Merge Cells',
                'Multi-line Text',
                'Name',
                'New Notification',
                'New Page',
                'No email content.',
                'No existing fields to select.',
                'No existing notifications to select.',
                'No fields available.',
                'No fields found.',
                'No notifications created.',
                'No notifications found.',
                'Not Send',
                'Number',
                'Open link in new tab',
                'Option Label',
                'Option Value',
                'Ordered List',
                'Page Label',
                'Paragraph',
                'Predefined Options',
                'Redo',
                'Refresh',
                'Reply To:',
                'Right (Save on Left)',
                'Right',
                'Save Button Label',
                'Save Button Style',
                'Save on Left',
                'Save on Right',
                'Save',
                'Select an option',
                'Select existing notification',
                'Select from predefined options and customize or paste your own to bulk add options.',
                'Select from the available predefined options.',
                'Select the data to be used as the option label.',
                'Select the data to be used as the option value.',
                'Select the style for the save button.',
                'Send Test Email',
                'Send',
                'Show Back Button',
                'Show Save Button',
                'Show',
                'Single-line Text',
                'Split Cells',
                'Status',
                'Strike',
                'Subject',
                'Subject:',
                'Submission',
                'Submit',
                'Subscript',
                'Superscript',
                'Synced',
                'Table',
                'Text',
                'The example below shows a preview of this email notification.',
                'The label for the back submit button.',
                'The label for the save submit button.',
                'The label for the submit button.',
                'The label for this page.',
                'The required attribute will not be synced across field instances.',
                'Time',
                'Title',
                'To:',
                'Toggle Header Cell',
                'Toggle Header Column',
                'Toggle Header Row',
                'URL cannot be blank.',
                'URL',
                'Underline',
                'Undo',
                'Unlink',
                'Unsaved',
                'Use the form below to send a test email to the nominated email address.',
                'Value',
                'Variables',
                'Warning: Currently editing synced field. Changes to this field will be applied to all instances of this field.',
                'Whether to enable conditional logic to control how the next button is shown.',
                'Whether to enable conditional logic to control how this page is shown.',
                'Whether to enable management of JavaScript events when this button is pressed.',
                'Whether to show the back button, to go back to a previous page.',
                'Whether to show the save button, allowing users to save progress on a submission to return later.',
                'contains',
                'ends with',
                'greater than',
                'is not',
                'is',
                'less than',
                'more',
                'of the following rules match.',
                'starts with',
                'this notification if',
            ]);
        }
    }
}
