<?php
/**
 * Order Shipped Email
 * Sent to customer when order is shipped
 */

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

class GGM_Commerce_Email_Order_Shipped extends GGM_Commerce_Email_Template {

    /**
     * Constructor
     */
    public function __construct() {
        $this->id             = 'order_shipped';
        $this->title          = __( 'Order Shipped', 'ggm-commerce' );
        $this->description    = __( 'Sent to customer when their order has been shipped.', 'ggm-commerce' );
        $this->recipient_type = 'customer';
    }

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

    /**
     * Get default heading
     *
     * @return string
     */
    public function get_default_heading() {
        return __( 'Your order is on its way!', 'ggm-commerce' );
    }

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

<p>Great news! Your order #{order_number} has been shipped and is on its way to you.</p>

<div class="address-box" style="margin: 24px 0;">
    <h4>Tracking Information</h4>
    <p><strong>Carrier:</strong> {carrier_name}<br>
    <strong>Tracking Number:</strong> {tracking_number}</p>
    <p style="margin-top: 12px;">
        <a href="{tracking_url}" class="button" style="display: inline-block; padding: 12px 24px; background: #2563eb; color: #ffffff; text-decoration: none; border-radius: 6px;">Track Your Package</a>
    </p>
</div>

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

<div class="address-box">
    <p>{shipping_address}</p>
</div>

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

{order_items_table}

<p style="margin-top: 32px;">If you have any questions about your delivery, please don\'t hesitate to contact us.</p>

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

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

        $placeholders['tracking_number'] = __( 'Tracking number', 'ggm-commerce' );
        $placeholders['tracking_url']    = __( 'Tracking URL', 'ggm-commerce' );
        $placeholders['carrier_name']    = __( 'Carrier name', 'ggm-commerce' );

        return $placeholders;
    }
}
