<?php

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

if ( class_exists( 'AIEO_Runtime_Fulfillment_URLs' ) ) {
    return;
}

class AIEO_Runtime_Fulfillment_URLs {

    
    public static function tracking_url($carrier, $voucher_no) {
        $carrier = strtolower((string) $carrier);
        $vno     = trim((string) $voucher_no);
        if ($vno === '') { return ''; }

        switch ($carrier) {
            case 'acs':
                return 'https://www.acscourier.net/el/track-trace?p_85_s=' . rawurlencode($vno);
            case 'geniki':
                return 'https://www.taxydromiki.com/en/track/' . rawurlencode($vno);
            case 'boxnow':
                return 'https://boxnow.gr/el/track?parcel=' . rawurlencode($vno);
            case 'elta':
                
                return 'https://www.elta-courier.gr/search?p=' . rawurlencode($vno);
            case 'speedex':
                return 'https://www.speedex.gr/speedex/NewTrackAndTrace.aspx?number=' . rawurlencode($vno);
            case 'manual':
            default:
                return '';
        }
    }

    
    public static function carrier_label($carrier) {
        $carrier = strtolower((string) $carrier);
        $defaults = array(
            'acs'     => 'ACS Courier',
            'geniki'  => 'Γενική Ταχυδρομική',
            'boxnow'  => 'BOX NOW',
            'elta'    => 'ELTA Courier',
            'speedex' => 'Speedex',
            'manual'  => '',
        );
        $label = isset($defaults[$carrier]) ? $defaults[$carrier] : strtoupper($carrier);
        return apply_filters('aieo_runtime_fulfillment_carrier_label', $label, $carrier);
    }
}
