<?php

namespace FiloBlu\Rma\Plugin;

/**
 *
 */
class EmailTemplate
{

    /**
     * @param $subject
     * @param $result
     * @return array
     */
    public function afterToOptionArray($subject, $result)
    {
        $customTemplates = [
            'sales_email_filoblu_extrma_email_order_changesize_template'       => 'New Order For ChangeSize (FiloBluRma)',
            'sales_email_filoblu_extrma_email_order_changesize_guest_template' => 'New Order For ChangeSize - Guest (FiloBluRma)',
            'filoblu_extrma_email_magento_rma_template'                        => 'Pending RMA Pending with ChangeSize(FiloBlu)',
            'filoblu_extrma_email_magento_rma_guest_template'                  => 'Pending RMA for Guest with ChangeSize(FiloBlu)',
            'sales_email_magento_rma_received_template'                        => 'RMA Received - Customer with ChangeSize (FiloBlu)',
            'sales_email_magento_rma_received_guest_template'                  => 'RMA Received - Guest with ChangeSize (FiloBlu)',
            'sales_email_magento_rma_auth_template'                            => 'RMA Authorized - Customer with ChangeSize (FiloBlu)',
            'sales_email_magento_rma_auth_guest_template'                      => 'RMA Authorized - Guest with ChangeSize (FiloBlu)',
            'sales_email_magento_rma_processed_closed_template'                => 'RMA Processed Closed - Customer with ChangeSize (FiloBlu)',
            'sales_email_magento_rma_processed_closed_guest_template'          => 'RMA Processed Closed - Guest with ChangeSize (FiloBlu)',
            'sales_email_magento_rma_closed_template'                          => 'RMA Closed - Customer with ChangeSize (FiloBlu)',
            'sales_email_magento_rma_closed_guest_template'                    => 'RMA Closed - Guest with ChangeSize (FiloBlu)',
            'sales_email_filoblu_extrma_wrong_item_email_template'             => 'Wrong Rma Item Email (FiloBlu)',
            'sales_email_filoblu_extrma_damaged_item_email_template'           => 'Damaged Rma Item Email (FiloBlu)'
        ];

        $ct = [];
        foreach ($customTemplates as $k => $v) {
            $ct[] = ['value' => $k, 'label' => $v];
        }
        array_walk(
            $ct,
            static function (&$item) {
                $item['__disableTmpl'] = true;
            }
        );

        return array_merge($result, $ct);
    }
}
