<?php

namespace App\Services\Shipping\Providers;

use App\Models\Order;
use App\Services\Shipping\Dto\ShipmentResponse;

class CorreosCRShippingProvider implements ShippingProvider
{
    /**
     * Estos atributos quedan listos para llenarse con credenciales reales.
     */
    public function __construct(
        public ?string $baseUrl,
        public ?string $username,
        public ?string $password,
        public ?string $contract,
    ) {
    }

    public function name(): string
    {
        return 'Correos de Costa Rica';
    }

    public function createShipment(Order $order): ShipmentResponse
    {
        // Stub: aquí irá la integración real. Por ahora generamos una guía determinística.
        $guide = 'CRC-'.$order->order_reference;

        return new ShipmentResponse(
            guideNumber: $guide,
            raw: [
                'provider' => 'correos_cr',
                'base_url' => $this->baseUrl,
                'contract' => $this->contract,
            ],
        );
    }
}
