<?php
namespace EasyChat\Library\Commerce;






final class ApiShipShipment
{
    public static function fromOfficialModule(string $client_number, string $external_order_id, string $provider_number, string $source): array
    {
        $client_number = preg_replace('/\s+/', '', trim($client_number));
        $external_order_id = trim($external_order_id);
        if ($client_number === '' || !preg_match('/^[A-Za-z0-9_.:-]{1,80}$/', $client_number)) {
            return array();
        }
        if (!preg_match('/^[1-9][0-9]{0,18}$/', $external_order_id)) {
            return array();
        }
        return array(
            'carrier' => 'ApiShip',
            'carrier_code' => 'apiship',
            'tracking_number' => $client_number,
            'client_number' => $client_number,
            'external_order_id' => $external_order_id,
            'provider_number' => mb_substr(preg_replace('/[^A-Za-z0-9_.:-]/', '', $provider_number), 0, 80, 'UTF-8'),
            'source' => $source,
            'status' => 'unknown',
            'status_label' => '',
            'updated_at' => '',
        );
    }
}
