<?php

namespace PWH_DCFH\App\Base;

if (!defined('ABSPATH')) {
    exit;
}
if (!class_exists('PWH_DCFH_Strings')) {
    class PWH_DCFH_Strings
    {
        private static $_instance;

        /**
         * Returns the singleton instance of the class.
         * @return self
         */
        public static function instance()
        {
            if (self::$_instance === null) {
                self::$_instance = new self();
            }

            return self::$_instance;
        }

        public function strings($key)
        {
            $is_multi_language = pwh_dcfh_db()::is_setting_enabled('pwh_dcfh_multilingual_enabled');
            $strings = [
                'admin_i10' => [
                    'please_wait_text' => __('Please wait...', 'pwh-dcfh'),
                    'smtp_host' => __('SMTP host required.', 'pwh-dcfh'),
                    'smtp_from_email' => __('SMTP from email required.', 'pwh-dcfh'),
                    'smtp_from_name' => __('SMTP from name required.', 'pwh-dcfh'),
                    'smtp_port' => __('SMTP port required.', 'pwh-dcfh'),
                    'smtp_username' => __('SMTP username required.', 'pwh-dcfh'),
                    'smtp_password' => __('SMTP password required.', 'pwh-dcfh'),
                    'smtp_settings_alert' => __('Have you saved your SMTP settings? Please save the settings before testing SMTP.', 'pwh-dcfh'),
                    'select_term' => __('Please Select Term', 'pwh-dcfh'),
                    'not_applicable' => __('Not Applicable', 'pwh-dcfh'),
                    'custom_field_name' => __('Enter custom field name.', 'pwh-dcfh'),
                    'choose_custom_field_name' => __('Choose Custom Field', 'pwh-dcfh'),
                    'tmd_email_address_required' => __('Email Address is required.', 'pwh-dcfh'),
                ],
                'frontend_i10' => [
                    'form_unique_id_warning' => __('Important: Unique ID Required<br>To ensure your form entries are saved correctly in the website database, each contact form must have a unique ID. This ID is essential for connecting the form to the database and identifying which entries belong to each form. Our plugin automatically assigns a unique ID in the "Admin Label" toggle in the Divi Contact Form settings. If you have more than one form on your site, each one must have a unique ID. This is managed automatically unless you duplicate a form using the Divi Builder\'s duplicate button. For more information on using unique IDs, please refer to our <a href="https://www.peeayecreative.com/docs/divi-contact-form-helper/saving-entries-to-database/" target="_blank">plugin documentation</a>.', 'pwh-dcfh'),
                    'file_upload_btn_text' => $is_multi_language ? __('Choose Files', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_file_upload_btn_text', 'Choose Files'),
                    'accepted_file_text' => $is_multi_language ? __('Accepted file types:', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_accepted_file_text', 'Accepted file types:'),
                    'max_filesize_text' => $is_multi_language ? __('Max. file size:', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_max_filesize_text', 'Max. file size:'),
                    'chosen_file_text' => $is_multi_language ? __('No file chosen', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_chosen_file_text', 'No file chosen'),
                    'selected_files_text' => $is_multi_language ? __('{chosen_files_count} file{_s_} selected', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_selected_files_text', '{chosen_files_count} file{_s_} selected'),
                    'uploading_text' => $is_multi_language ? __('{percentage} uploaded your files, please wait for the system to continue.', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_uploading_text', '{percentage} uploaded your files, please wait for the system to continue.'),
                    'already_attached_text' => $is_multi_language ? __('File {filename} has already attached. Please choose another file.', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_already_attached_text', 'File {filename} has already attached. Please choose another file.'),
                    'allow_filesize_text' => $is_multi_language ? __('File {filename} not uploaded. Maximum file size {allowed_filesize}.', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_allow_filesize_text', 'File {filename} not uploaded. Maximum file size {allowed_filesize}.'),
                    'x_files_allow_text' => $is_multi_language ? __('Only {allowed_files} files are allowed to upload.', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_x_files_allow_text', 'Only {allowed_files} files are allowed to upload.'),
                    'remove_file_text' => $is_multi_language ? __('Are you sure you want to remove {filename}?', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_remove_file_text', 'Are you sure you want to remove {filename}?'),
                    'delete_file_icon_hover_text' => $is_multi_language ? __('Remove an attachment', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_delete_file_icon_hover_text', 'Remove an attachment'),
                    'security_reason_text' => $is_multi_language ? __('File {filename} has failed to upload. Sorry, this file type is not permitted for security reasons.', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_security_reason_text', 'File {filename} has failed to upload. Sorry, this file type is not permitted for security reasons.'),
                    'fill_message_text' => $is_multi_language ? __('Please fill in the following fields:', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_fill_message_text', 'Please fill in the following fields:'),
                    'fix_message_text' => $is_multi_language ? __('Please fix the following errors:', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_fix_message_text', 'Please fix the following errors:'),
                    'siganture_empty_text' => $is_multi_language ? __('The signature pad is empty. Please sign it and then save.', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_siganture_empty_text', 'The signature pad is empty. Please sign it and then save.'),
                    'siganture_before_save_text' => $is_multi_language ? __('Are you sure you want to save the signature?', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_siganture_before_save_text', 'Are you sure you want to save the signature?'),
                    'siganture_save_text' => $is_multi_language ? __('The signature has been saved successfully!', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_siganture_save_text', 'The signature has been saved successfully!'),
                    'siganture_delete_text' => $is_multi_language ? __('The signature has been deleted successfully!', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_siganture_delete_text', 'The signature has been deleted successfully!'),
                    'siganture_save_btn_text' => $is_multi_language ? __('Save', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_siganture_save_btn_text', 'Save'),
                    'siganture_clear_btn_text' => $is_multi_language ? __('Clear', 'pwh-dcfh') : pwh_dcfh_db()::get_setting('pwh_dcfh_siganture_clear_btn_text', 'Clear'),
                ]
            ];

            return $strings[$key];
        }
    }
}