<?php
/**
 * Refund Email
 * Sent to customer when order is refunded
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

class GGM_Commerce_Email_Refund extends GGM_Commerce_Email_Template {

    /**
     * Constructor
     */
    public function __construct() {
        $this->id             = 'refund';
        $this->title          = __( 'Refund Notification', 'ggm-commerce' );
        $this->description    = __( 'Sent to customer when their order is refunded.', 'ggm-commerce' );
        $this->recipient_type = 'customer';
    }

    /**
     * Get default subject
     *
     * @return string
     */
    public function get_default_subject() {
        return __( 'Refund processed for order #{order_number}', 'ggm-commerce' );
    }

    /**
     * Get default heading
     *
     * @return string
     */
    public function get_default_heading() {
        return __( 'Your refund has been processed', 'ggm-commerce' );
    }

    /**
     * Get default content
     *
     * @return string
     */
    public function get_default_content() {
        return '
<p>Hi {customer_first_name},</p>

<p>We have processed a refund for your order #{order_number}.</p>

<div class="address-box" style="margin: 24px 0; background: #fef3c7; border-left: 4px solid #d97706;">
    <h4 style="color: #92400e;">Refund Details</h4>
    <p><strong>Refund Amount:</strong> {order_total}</p>
</div>

<p>Please note that it may take 5-10 business days for the refund to appear in your account, depending on your payment provider.</p>

<h3 style="margin: 24px 0 16px 0; font-size: 18px; color: #1f2937;">Original Order</h3>

<p><strong>Order Number:</strong> #{order_number}<br>
<strong>Order Date:</strong> {order_date}</p>

{order_items_table}

<p style="margin-top: 32px;">If you have any questions about your refund, please contact us at {business_email}.</p>

<p>We\'re sorry to see this order returned. If there\'s anything we can do to improve your experience, please let us know.</p>
';
    }

    /**
     * Get available placeholders
     *
     * @return array
     */
    public function get_placeholders() {
        $placeholders = parent::get_placeholders();

        $placeholders['refund_amount'] = __( 'Refund amount', 'ggm-commerce' );
        $placeholders['refund_reason'] = __( 'Refund reason', 'ggm-commerce' );

        return $placeholders;
    }
}
