<?php

namespace FiloBlu\Storelocator\Plugin;

/**
 *
 */
class EmailTemplate
{

    /**
     * @param $subject
     * @param $result
     * @return mixed
     */
    public function afterToOptionArray($subject, $result)
    {
        // TODO: semplify logic

        $customTemplates = [
            'carriers_pickupinstore_refilo_email_to_store_template' => 'Refilo Pick Up In Store Confirmation To Store'
        ];
        $customTemplate = [];
        foreach ($customTemplates as $k => $v) {
            $customTemplate[] = ['value' => $k, 'label' => $v];
        }
        array_walk(
            $customTemplate,
            static function (&$item) {
                $item['__disableTmpl'] = true;
            }
        );

        return array_merge($result, $customTemplate);
    }

}
