<?php
/**
 * Order Confirmation Email
 * Sent to customer when payment is successful
 */

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

class GGM_Commerce_Email_Order_Confirmation extends GGM_Commerce_Email_Template {

    /**
     * Constructor
     */
    public function __construct() {
        $this->id             = 'order_confirmation';
        $this->title          = __( 'Order Confirmation', 'ggm-commerce' );
        $this->description    = __( 'Sent to customer when their order payment is successful.', 'ggm-commerce' );
        $this->recipient_type = 'customer';
    }

    /**
     * Get default subject
     *
     * @return string
     */
    public function get_default_subject() {
        return __( 'Your order #{order_number} has been confirmed', 'ggm-commerce' );
    }

    /**
     * Get default heading
     *
     * @return string
     */
    public function get_default_heading() {
        return __( 'Thank you for your order!', 'ggm-commerce' );
    }

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

<p>Thank you for your order. We have received your payment and your order is now being processed.</p>

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

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

{order_items_table}

{checkout_fields}

<div style="display: flex; gap: 24px; margin-top: 32px;">
    <div class="address-box" style="flex: 1;">
        <h4>Billing Address</h4>
        <p>{billing_address}</p>
    </div>
    <div class="address-box" style="flex: 1;">
        <h4>Shipping Address</h4>
        <p>{shipping_address}</p>
    </div>
</div>

<p style="margin-top: 32px;">We will notify you when your order has been shipped. If you have any questions about your order, please contact us.</p>

<p>Thank you for shopping with us!</p>
';
    }
}
